W3cubDocs

/OpenJDK 8 GUI

Class BasicArrowButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants
Direct Known Subclasses:
MetalScrollButton
public class BasicArrowButton
extends JButton
implements SwingConstants

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™ has been added to the java.beans package. Please see XMLEncoder.

Nested Classes

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

Fields

direction

protected int direction

The direction of the arrow. One of SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST or SwingConstants.WEST.

Constructors

BasicArrowButton

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

BasicArrowButton

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

Methods

getDirection

public int getDirection()

Returns the direction of the arrow.

setDirection

public void setDirection(int direction)

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

paint

public void paint(Graphics g)

Description copied from class: JComponent

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.

Overrides:
paint in class JComponent
Parameters:
g - the Graphics context in which to paint
See Also:
JComponent.paintComponent(java.awt.Graphics), JComponent.paintBorder(java.awt.Graphics), JComponent.paintChildren(java.awt.Graphics), JComponent.getComponentGraphics(java.awt.Graphics), JComponent.repaint(long, int, int, int, int)

getPreferredSize

public Dimension getPreferredSize()

Returns the preferred size of the BasicArrowButton.

Overrides:
getPreferredSize in class JComponent
Returns:
the preferred size
See Also:
JComponent.setPreferredSize(java.awt.Dimension), ComponentUI

getMinimumSize

public Dimension getMinimumSize()

Returns the minimum size of the BasicArrowButton.

Overrides:
getMinimumSize in class JComponent
Returns:
the minimum size
See Also:
JComponent.setMinimumSize(java.awt.Dimension), ComponentUI

getMaximumSize

public Dimension getMaximumSize()

Returns the maximum size of the BasicArrowButton.

Overrides:
getMaximumSize in class JComponent
Returns:
the maximum size
See Also:
JComponent.setMaximumSize(java.awt.Dimension), ComponentUI

isFocusTraversable

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.

Overrides:
isFocusTraversable in class Component
Returns:
false
See Also:
Component.setFocusable(boolean)

paintTriangle

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

© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.