public class BevelArrowIcon
extends java.lang.Object
implements javax.swing.Icon
This class (and also SortButtonRenderer) is based on original code by Nobuo Tamemasa (version 1.0, 26-Feb-1999) posted on www.codeguru.com.
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_SIZE
The default arrow size.
|
private int |
direction
The direction that the arrow is pointing (UP or DOWN).
|
static int |
DOWN
Constant indicating that the arrow is pointing down.
|
private java.awt.Color |
edge1
Edge color 1.
|
private java.awt.Color |
edge2
Edge color 2.
|
private java.awt.Color |
fill
The fill color for the arrow icon.
|
private int |
size
The size of the icon.
|
static int |
UP
Constant indicating that the arrow is pointing up.
|
| Constructor and Description |
|---|
BevelArrowIcon(java.awt.Color edge1,
java.awt.Color edge2,
java.awt.Color fill,
int size,
int direction)
Standard constructor - builds an icon with the specified attributes.
|
BevelArrowIcon(int direction,
boolean isRaisedView,
boolean isPressedView)
Standard constructor - builds an icon with the specified attributes.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
drawDownArrow(java.awt.Graphics g,
int xo,
int yo)
Draws the arrow pointing down.
|
private void |
drawUpArrow(java.awt.Graphics g,
int xo,
int yo)
Draws the arrow pointing up.
|
int |
getIconHeight()
Returns the height of the icon.
|
int |
getIconWidth()
Returns the width of the icon.
|
private void |
init(java.awt.Color edge1,
java.awt.Color edge2,
java.awt.Color fill,
int size,
int direction)
Initialises the attributes of the arrow icon.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the icon at the specified position.
|
public static final int UP
public static final int DOWN
private static final int DEFAULT_SIZE
private java.awt.Color edge1
private java.awt.Color edge2
private java.awt.Color fill
private int size
private int direction
public BevelArrowIcon(int direction,
boolean isRaisedView,
boolean isPressedView)
direction - .isRaisedView - .isPressedView - .public BevelArrowIcon(java.awt.Color edge1,
java.awt.Color edge2,
java.awt.Color fill,
int size,
int direction)
edge1 - the color of edge1.edge2 - the color of edge2.fill - the fill color.size - the size of the arrow icon.direction - the direction that the arrow points.public void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paintIcon in interface javax.swing.Iconc - .g - .x - .y - .public int getIconWidth()
getIconWidth in interface javax.swing.Iconpublic int getIconHeight()
getIconHeight in interface javax.swing.Iconprivate void init(java.awt.Color edge1,
java.awt.Color edge2,
java.awt.Color fill,
int size,
int direction)
edge1 - the color of edge1.edge2 - the color of edge2.fill - the fill color.size - the size of the arrow icon.direction - the direction that the arrow points.private void drawDownArrow(java.awt.Graphics g,
int xo,
int yo)
g - the graphics device.xo - ??yo - ??private void drawUpArrow(java.awt.Graphics g,
int xo,
int yo)
g - the graphics device.xo - ??yo - ??