uk.co.ist.mwt
Class ArrowButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--uk.co.ist.mwt.ShadowedComponent
                          |
                          +--uk.co.ist.mwt.BoxedButton
                                |
                                +--uk.co.ist.mwt.ArrowButton

public class ArrowButton
extends BoxedButton

An ArrowButton mimics a Motif XmArrowButton

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static int kArrowDown
          A constant value for specifying that the arrow in the button points down
static int kArrowLeft
          A constant value for specifying that the arrow in the button points left
static int kArrowRight
          A constant value for specifying that the arrow in the button points right
static int kArrowUp
          A constant value for specifying that the arrow in the button points up
 
Fields inherited from class uk.co.ist.mwt.ShadowedComponent
shadowDrawer
 
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
 
Constructor Summary
ArrowButton()
          Constructor - set some sensible defaults
 
Method Summary
protected  void draw3DArrow(java.awt.Graphics g, java.awt.Rectangle bounds, boolean in, boolean reflectXY, boolean reflectX)
          Draws a 3D arrow.
 int getArrowDirection()
          Accessor to get the direction of the arrow
 java.awt.Dimension getMinimumSize()
          Calculates the minimum size of the arrow button
 java.awt.Dimension getPreferredSize()
          Calculates the preferred size of the arrow button
 void paintComponent(java.awt.Graphics g)
          Paints the arrow which makes up the component
 void setArrowDirection(int direction)
          Accessor to set the direction of the arrow; sets it to up if an unrecognised value is passed in
protected  boolean sinkOnArm()
          A method to specify if this component should appear to sink into the background when it is armed.
 
Methods inherited from class uk.co.ist.mwt.BoxedButton
addActionListener, armed, onMouseDown, onMouseEnter, onMouseExit, onMouseUp, processActionEvent, processMouseEvent, removeActionListener
 
Methods inherited from class uk.co.ist.mwt.ShadowedComponent
draw3DRect, draw3DRect, draw3DRect, draw3DRect, drawShadow, drawShadow, getBottomShadowColor, getShadowThickness, getTopShadowColor, setBottomShadowColor, setShadowThickness, setTopShadowColor
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kArrowUp

public static final int kArrowUp
A constant value for specifying that the arrow in the button points up

kArrowDown

public static final int kArrowDown
A constant value for specifying that the arrow in the button points down

kArrowLeft

public static final int kArrowLeft
A constant value for specifying that the arrow in the button points left

kArrowRight

public static final int kArrowRight
A constant value for specifying that the arrow in the button points right
Constructor Detail

ArrowButton

public ArrowButton()
Constructor - set some sensible defaults
Method Detail

setArrowDirection

public void setArrowDirection(int direction)
Accessor to set the direction of the arrow; sets it to up if an unrecognised value is passed in

getArrowDirection

public int getArrowDirection()
Accessor to get the direction of the arrow

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the arrow which makes up the component
Overrides:
paintComponent in class BoxedButton
Tags copied from class: BoxedButton
Parameters:
g - the graphics context into which we should draw

draw3DArrow

protected void draw3DArrow(java.awt.Graphics g,
                           java.awt.Rectangle bounds,
                           boolean in,
                           boolean reflectXY,
                           boolean reflectX)
Draws a 3D arrow. The arrow points upward by default; arrows pointing in other directions can be draw by the use of the reflecting parameters.
Parameters:
g - the graphics context in which the drawing should take place
bounds - a bounding box for the arrow
in - a flag to specify that the arrow is sunken in
reflectXY - reflect the arrow along a line from the bottom left of the bounding box to the top right.
reflectX - reflect the arrow along a horizontal line halfway up the bounding box. This takes place before any reflection along the diagonals.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Calculates the preferred size of the arrow button
Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
a preferred size.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Calculates the minimum size of the arrow button
Overrides:
getMinimumSize in class javax.swing.JComponent
Returns:
a minimum size.

sinkOnArm

protected boolean sinkOnArm()
A method to specify if this component should appear to sink into the background when it is armed.
Overrides:
sinkOnArm in class BoxedButton