is new.
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JButton
javax.swing.plaf.basic.BasicArrowButton
public class BasicArrowButton
JButton object that draws a scaled Arrow in one of the cardinal directions.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans TM has been added to the java.beans package. Please see XMLEncoder .
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing. JButton |
|---|
| JButton.AccessibleJButton |
| Nested classes/interfaces inherited from class javax.swing. AbstractButton |
|---|
| AbstractButton.AccessibleAbstractButton , AbstractButton.ButtonChangeListener |
| Nested classes/interfaces inherited from class javax.swing. JComponent |
|---|
| JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt. Container |
|---|
| Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt. Component |
|---|
| Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
| protected int |
direction
The direction of the arrow.
|
| Fields inherited from class javax.swing. JComponent |
|---|
| accessibleContext , listenerList , TOOL_TIP_TEXT_KEY , ui , UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt. Component |
|---|
| BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
| Fields inherited from interface javax.swing. SwingConstants |
|---|
| BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
| Fields inherited from interface java.awt.image. ImageObserver |
|---|
| ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
| Constructor Summary | |
|---|---|
BasicArrowButton
(int direction)
Creates a BasicArrowButton whose arrow is drawn in the specified direction.
|
|
BasicArrowButton
(int direction,
Color
background,
Color
shadow,
Color
darkShadow,
Color
Creates a BasicArrowButton whose arrow is drawn in the specified direction and with the specified colors.
|
|
| Method Summary | |
|---|---|
| int |
getDirection
()
Returns the direction of the arrow.
|
| Dimension |
getMaximumSize
()
Returns
of the BasicArrowButton.
|
| Dimension |
getMinimumSize
()
Returns
of the BasicArrowButton.
|
| Dimension |
getPreferredSize
()
Returns
preferred size of the BasicArrowButton.
|
| boolean |
isFocusTraversable
() Returns whether
arrow button should get the focus.
|
| void |
paint
(
Graphics
g) Invoked by Swing to draw components. |
| void |
paintTriangle
(
Graphics
Paints a triangle.
|
| void |
setDirection
(int dir)
Sets the direction of the arrow.
|
| Methods inherited from class javax.swing. JButton |
|---|
| getAccessibleContext , getUIClassID , isDefaultButton , isDefaultCapable , paramString , removeNotify , setDefaultCapable , updateUI |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , wait , wait , wait |
| Field Detail |
|---|
protected int direction
The direction of the arrow. One of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST.
| Constructor Detail |
|---|
public BasicArrowButton(int direction,
Color background,
Color shadow,
Color darkShadow,
Color highlight)
Creates a BasicArrowButton whose arrow is drawn in the specified direction and with the specified colors.
Parameters:
direction - the direction of the arrow; one of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST
background - the background color of the button
shadow - the color of the shadow
darkShadow - the color of the dark shadow
highlight - the color of the highlight
Since:
1.4
public BasicArrowButton(int direction)
Creates a BasicArrowButton whose arrow is drawn in the specified direction.
Parameters:
direction - the direction of the arrow; one of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST
| Method Detail |
|---|
public int getDirection()
Returns the direction of the arrow.
Parameters:
direction - the direction of the arrow; one of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST
public void setDirection(int dir)
Sets the direction of the arrow.
Parameters:
direction - the direction of the arrow; one of of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST
public void paint(Graphics g)
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.
public Dimension getPreferredSize()
Returns the preferred size of the BasicArrowButton.
the preferred size
public Dimension getMinimumSize()
Returns the minimum size of the BasicArrowButton.
the minimum size
public Dimension getMaximumSize()
Returns the maximum size of the BasicArrowButton.
the maximum size
public boolean isFocusTraversable()
Returns whether the arrow button should get the focus. BasicArrowButtons are used as a child component of composite components such as JScrollBar and JComboBox. Since the composite component typically gets the focus, this method is overriden to return false.
false
public void paintTriangle(Graphics g,
int x,
int y,
int size,
int direction,
boolean isEnabled)
Paints a triangle.
Parameters:
g - the Graphics to draw to
x - the x coordinate
y - the y coordinate
size - the size of the triangle to draw
direction - the direction in which to draw the arrow; one of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST
isEnabled - whether or not the arrow is drawn enabled