com.sas.swing.visuals
Class ArrowIcon

com.sas.swing.visuals.ArrowIcon
All Implemented Interfaces:
javax.swing.Icon

public class ArrowIcon
implements javax.swing.Icon

ArrowIcon is used by the SpinButton to paint the up/down arrows on the buttons. ArrowIcon implements Icon so it can be used on any AbstractButton. The constructor for the ArrowIcon can take a direction that the arrow is supposed to be painted in, using the SwingConstants NORTH, SOUTH, WEST, and EAST as valid values. Also, you can set whether the arrow should be painted pressed (just translates the arrow down and to the right 1 pixel). This functionality is added as a convenience to the user if they want a more visual appearance of the button being pressed. The default direction the Arrow faces is down (south).

See Also:
Icon, SpinBox,


Field Summary
protected  int arrowDirection
           
protected  boolean pressed
           
 
Constructor Summary
ArrowIcon()
          Default constructor, creates a arrow facing down (south).
ArrowIcon(boolean pressed)
          Creates a arrow facing down (south), and if pressed is true, the arrow will be moved down and to the right one pixel.
ArrowIcon(int direction)
          Creates a arrow facing in the direction specified.
ArrowIcon(int direction, boolean pressed)
          Creates a arrow facing in the direction specified.
 
Method Summary
 int getDirection()
          Returns the SwingConstants representing the direction the arrow is facing.
 int getIconHeight()
          Stubbed to statify the interface.
 int getIconWidth()
          Stubbed to statify the interface.
 boolean isPressed()
          Returns whether the arrow is to be painted in pressed mode, that is, move the arrow down and to the right one pixel.
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Paints the arrow in the specified direction.
 void setDirection(int newValue)
          Sets the direction the arrow is to face when painted.
 void setPressed(boolean newValue)
          Sets whether the arrow is to be painted in pressed mode, that is, move the arrow down and to the right one pixel.
 

Field Detail

arrowDirection

protected int arrowDirection

pressed

protected boolean pressed
Constructor Detail

ArrowIcon

public ArrowIcon()
Default constructor, creates a arrow facing down (south).

See Also:
SwingConstants

ArrowIcon

public ArrowIcon(int direction)
Creates a arrow facing in the direction specified. Valid values are SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.WEST, and SwingConstants.EAST.

Parameters:
direction - The direction the arrow is to face
See Also:
SwingConstants

ArrowIcon

public ArrowIcon(boolean pressed)
Creates a arrow facing down (south), and if pressed is true, the arrow will be moved down and to the right one pixel.

Parameters:
pressed - true to have the arrow moved down and to the right one pixel, false otherwise
See Also:
SwingConstants

ArrowIcon

public ArrowIcon(int direction,
                 boolean pressed)
Creates a arrow facing in the direction specified. Valid values are SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.WEST, and SwingConstants.EAST.

Parameters:
direction - The direction the arrow is to face
pressed - true to have the arrow moved down and to the right one pixel, false otherwise
See Also:
SwingConstants
Method Detail

setDirection

public void setDirection(int newValue)
Sets the direction the arrow is to face when painted. Valid values are SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.WEST, and SwingConstants.EAST. The default value is SwingConstants.SOUTH.

Parameters:
newValue - The direction the arrow is to face
See Also:
SwingConstants

getDirection

public int getDirection()
Returns the SwingConstants representing the direction the arrow is facing. Valid values are SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.WEST, and SwingConstants.EAST. The default value is SwingConstants.SOUTH.

Returns:
The direction the arrow is to face
See Also:
SwingConstants

setPressed

public void setPressed(boolean newValue)
Sets whether the arrow is to be painted in pressed mode, that is, move the arrow down and to the right one pixel. The default value is false.

Parameters:
newValue - true to have the arrow moved down and to the right one pixel, false otherwise

isPressed

public boolean isPressed()
Returns whether the arrow is to be painted in pressed mode, that is, move the arrow down and to the right one pixel. The default value is false.

Returns:
true to have the arrow moved down and to the right one pixel, false otherwise

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Paints the arrow in the specified direction. The x and y parameters are ignored.

Specified by:
paintIcon in interface javax.swing.Icon

getIconWidth

public int getIconWidth()
Stubbed to statify the interface. Always returns 12 even though the arrow changes size based based on the component.

Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Stubbed to statify the interface. Always returns 12 even though the arrow changes size based based on the component.

Specified by:
getIconHeight in interface javax.swing.Icon



Copyright © 2009 SAS Institute Inc. All Rights Reserved.