Package com.moneydance.awt
Class ArrowIcon
java.lang.Object
com.moneydance.awt.ArrowIcon
- All Implemented Interfaces:
javax.swing.Icon
public class ArrowIcon
extends java.lang.Object
implements javax.swing.Icon
ArrowIcon is an icon with given arrow shape, defined by the direction, enable status, and size (length and width).
Here's a diagram:
A |\ | \ C--E | / |/ B
where distance C - E is the length of the arrow, while distance A - B is the width of the arrow. A width of zero is not allowed, but a length of zero is allowed and creates a bar of the specified width.
When a triangle shape is selected, the ArrowHead
class is used to draw the
triangle.
- Author:
- Kevin Menningen
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ArrowIcon(int direction, boolean isEnabled)
Create an ArrowIcon with the given direction and enablement status and the default size and length.ArrowIcon(int direction, boolean isEnabled, int length, int width)
Create an ArrowIcon with given direction, enable status, shape, and size. -
Method Summary
Modifier and Type Method Description int
getDirection()
Get the arrow icon direction.int
getIconHeight()
Returns the icon's height.int
getIconWidth()
Returns the icon's width.void
paintIcon(java.awt.Component comp, java.awt.Graphics graphics, int xValue, int yValue)
Draw the icon.void
setEnabled(boolean isEnabled)
Set the enable status.
-
Field Details
-
SOUTH
public static final int SOUTHThe arrow should point to the south.- See Also:
- Constant Field Values
-
NORTH
public static final int NORTHThe arrow should point to the north.- See Also:
- Constant Field Values
-
EAST
public static final int EASTThe arrow should point to the east.- See Also:
- Constant Field Values
-
WEST
public static final int WESTThe arrow should point to the west.- See Also:
- Constant Field Values
-
-
Constructor Details
-
ArrowIcon
public ArrowIcon(int direction, boolean isEnabled)Create an ArrowIcon with the given direction and enablement status and the default size and length.- Parameters:
direction
- Direction of the arrow, could be SwingConstants.SOUTH, SwingConstants.NORTH, SwingConstants.EAST, or SwingConstants.WESTisEnabled
- Represents the enable status of the ArrowIcon. Paint in foreground text color if true, or disabled color if false.
-
ArrowIcon
public ArrowIcon(int direction, boolean isEnabled, int length, int width)Create an ArrowIcon with given direction, enable status, shape, and size. To get the real height and width of the icon need to use
getIconHeight()
andgetIconWidth()
.- Parameters:
direction
- direction of the arrow, could be SwingConstants.SOUTH, SwingConstants.NORTH, SwingConstants.EAST, or SwingConstants.WESTisEnabled
- Represents the enable status of the ArrowIcon. Paint in foreground text color if true, or disabled color if false.length
- The length of the icon, see theclass notes
. If less than zero, length is set to zero.width
- The width of the icon, see theclass notes
. If less than one, width is set to one.
-
-
Method Details
-
paintIcon
public void paintIcon(java.awt.Component comp, java.awt.Graphics graphics, int xValue, int yValue)Draw the icon.- Specified by:
paintIcon
in interfacejavax.swing.Icon
- Parameters:
comp
- Component parameter.graphics
- Graphics.xValue
- Left position.yValue
- Top position.
-
getIconWidth
public int getIconWidth()Returns the icon's width.- Specified by:
getIconWidth
in interfacejavax.swing.Icon
- Returns:
- an int specifying the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Returns the icon's height.- Specified by:
getIconHeight
in interfacejavax.swing.Icon
- Returns:
- an int specifying the fixed height of the icon.
-
getDirection
public int getDirection()Get the arrow icon direction.- Returns:
- arrow direction. SwingConstants.SOUTH, SwingConstants.NORTH, SwingConstants.EAST, or SwingConstants.WEST.
-
setEnabled
public void setEnabled(boolean isEnabled)Set the enable status.- Parameters:
isEnabled
- true if enabled, false otherwise.
-