net.sf.nachocalendar.components

Class ArrowButton


public class ArrowButton
extends JButton

JButton showing an arrow.
Author:
Ignacio Merani

Constructor Summary

ArrowButton(int direction)
Creates a new instance of ArrowButton.

Method Summary

int
getDirection()
Getter for property direction.
Dimension
getPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
void
paint(Graphics g)
Invoked by Swing to draw components.
void
setDirection(int direction)
Setter for property direction.

Constructor Details

ArrowButton

public ArrowButton(int direction)
Creates a new instance of ArrowButton.
Parameters:
direction - direction of the arrow

Method Details

getDirection

public int getDirection()
Getter for property direction.
Returns:
Value of property direction.

getPreferredSize

public Dimension getPreferredSize()
If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize method returns a non null value then return that; otherwise defer to the component's layout manager.
Returns:
the value of the preferredSize property

paint

public void paint(Graphics g)
Invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing.

This method actually delegates the work of painting to three protected methods: paintComponent, paintBorder, and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override paintComponent.

Parameters:
g - the Graphics context in which to paint

setDirection

public void setDirection(int direction)
Setter for property direction.
Parameters:
direction - New value of property direction.