uk.co.ist.mwt
Class BoxedButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--uk.co.ist.mwt.ShadowedComponent
                          |
                          +--uk.co.ist.mwt.BoxedButton
Direct Known Subclasses:
ArrowButton, ImageButton

public class BoxedButton
extends ShadowedComponent

The BoxedButton is a simple button class which implements the shadows and event generation behaviour expected of a button. It is used in this package as a base class for other button types.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
BoxedButton()
          Creates a default boxed button
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds a listener for action events from this component.
protected  boolean armed()
          Is the component currently armed? This is the case if the user has pressed the mouse button over the component, but has not yet released it, and the pointer is over the component.
 void onMouseDown(java.awt.event.MouseEvent e)
          Event handler - keeps track of state so that the armed() method returns the correct value.
 void onMouseEnter(java.awt.event.MouseEvent e)
          Event handler - keeps track of state so that the armed() method returns the correct value.
 void onMouseExit(java.awt.event.MouseEvent e)
          Event handler - keeps track of state so that the armed() method returns the correct value.
 void onMouseUp(java.awt.event.MouseEvent e)
          Event handler - keeps track of state so that the armed() method returns the correct value.
 void paintComponent(java.awt.Graphics g)
          The method to paint the shadows which make this component stand out from the background
protected  void processActionEvent(java.awt.event.ActionEvent ev)
          Method to dispatch action events to this component's listeners
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Event handler - keeps track of state so that the armed() method returns the correct value.
 void removeActionListener(java.awt.event.ActionListener l)
          Removes a listener for action events from this component.
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.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, getMinimumSize, getNextFocusableComponent, getPreferredSize, 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
 

Constructor Detail

BoxedButton

public BoxedButton()
Creates a default boxed button
Method Detail

armed

protected boolean armed()
Is the component currently armed? This is the case if the user has pressed the mouse button over the component, but has not yet released it, and the pointer is over the component.
See Also:
Component.mouseDown(java.awt.Event, int, int), Component.mouseUp(java.awt.Event, int, int), Component.mouseEnter(java.awt.Event, int, int), Component.mouseExit(java.awt.Event, int, int)

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Event handler - keeps track of state so that the armed() method returns the correct value. Delegates particular event types to other methods
Overrides:
processMouseEvent in class java.awt.Component
See Also:
onMouseDown(java.awt.event.MouseEvent), onMouseUp(java.awt.event.MouseEvent), onMouseEnter(java.awt.event.MouseEvent), onMouseExit(java.awt.event.MouseEvent)

onMouseDown

public void onMouseDown(java.awt.event.MouseEvent e)
Event handler - keeps track of state so that the armed() method returns the correct value.
See Also:
armed(), onMouseUp(java.awt.event.MouseEvent), onMouseEnter(java.awt.event.MouseEvent), onMouseExit(java.awt.event.MouseEvent)

onMouseUp

public void onMouseUp(java.awt.event.MouseEvent e)
Event handler - keeps track of state so that the armed() method returns the correct value.
See Also:
armed(), onMouseDown(java.awt.event.MouseEvent), onMouseEnter(java.awt.event.MouseEvent), onMouseExit(java.awt.event.MouseEvent)

onMouseEnter

public void onMouseEnter(java.awt.event.MouseEvent e)
Event handler - keeps track of state so that the armed() method returns the correct value.
See Also:
armed(), onMouseDown(java.awt.event.MouseEvent), onMouseUp(java.awt.event.MouseEvent), onMouseExit(java.awt.event.MouseEvent)

onMouseExit

public void onMouseExit(java.awt.event.MouseEvent e)
Event handler - keeps track of state so that the armed() method returns the correct value.
See Also:
armed(), onMouseDown(java.awt.event.MouseEvent), onMouseUp(java.awt.event.MouseEvent), onMouseEnter(java.awt.event.MouseEvent)

paintComponent

public void paintComponent(java.awt.Graphics g)
The method to paint the shadows which make this component stand out from the background
Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - the graphics context into which we should draw

sinkOnArm

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

processActionEvent

protected void processActionEvent(java.awt.event.ActionEvent ev)
Method to dispatch action events to this component's listeners

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds a listener for action events from this component.
See Also:
removeActionListener(java.awt.event.ActionListener)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes a listener for action events from this component.
See Also:
addActionListener(java.awt.event.ActionListener)