edu.neu.ccs.gui
Class PaintActionCapsule

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byedu.neu.ccs.gui.PaintActionCapsule
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class PaintActionCapsule
extends JComponent

A JComponent that contains a sequence of action listeners performed every time this component is painted.

Since:
2.2
Version:
2.2
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ActionSequence actions
          Sequence of action listeners to perform when painted.
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PaintActionCapsule()
          Constructs a component with no action listeners to perform.
PaintActionCapsule(ActionListener a)
          Constructs a component that performs the given action listener each time it is painted.
PaintActionCapsule(ActionListener[] a)
          Constructs a component that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener[] a, Color c)
          Constructs a component with the given foreground color that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener[] a, Color c, Dimension d)
          Constructs a component with the given foreground color and preferred size that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener[] a, Color c, int width, int height)
          Constructs a component with the given foreground color and preferred dimensions that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener[] a, Dimension d)
          Constructs a component with the given preferred size that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener[] a, int width, int height)
          Constructs a component with the given preferred size that performs the given action listeners each time it is painted.
PaintActionCapsule(ActionListener a, Color c)
          Constructs a component with the given foreground color that performs the given action listener each time it is painted.
PaintActionCapsule(ActionListener a, Color c, Dimension d)
          Constructs a component with the given foreground color and preferred size that performs the given action listener each time it is painted.
PaintActionCapsule(ActionListener a, Color c, int width, int height)
          Constructs a component with the given foreground color and preferred dimensions that performs the given action listener each time it is painted.
PaintActionCapsule(ActionListener a, Dimension d)
          Constructs a component with the given preferred size that performs the given action listener each time it is painted.
PaintActionCapsule(ActionListener a, int width, int height)
          Constructs a component with the given preferred dimensions that performs the given action listener each time it is painted.
 
Method Summary
 void addAction(ActionListener a)
          Adds the given action listener to the end of the sequence of action listeners performed when this component is painted.
 void addActions(ActionListener[] a)
          Adds the action listeners in the given array, in order, to the end of the sequence of action listeners performed when this component is painted.
 ActionSequence getActionSequence()
          Returns the sequence of action listeners performed when this component is painted.
protected  void paintComponent(Graphics g)
          Performs the stored sequence of action listeners.
 boolean removeAction(ActionListener a)
          Removes the first occurrence of the given action listener in the sequence of action listeners performed when this component is painted, and returns true, or returns false if the sequence does not contain the action listener.
 void setAction(ActionListener a)
          Sets the action performed when this component is painted to the given action listener.
 void setActions(ActionListener[] a)
          Sets the action listeners performed when this component is painted to the action listeners in the given array, in order.
 void setActionSequence(ActionSequence sequence)
          Sets the sequence of action listeners performed when this component is painted to the given sequence of action listeners.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

actions

protected ActionSequence actions
Sequence of action listeners to perform when painted.

Constructor Detail

PaintActionCapsule

public PaintActionCapsule()
Constructs a component with no action listeners to perform.


PaintActionCapsule

public PaintActionCapsule(ActionListener a)
Constructs a component that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
See Also:
PaintActionCapsule(ActionListener, Color), PaintActionCapsule(ActionListener, Dimension), PaintActionCapsule(ActionListener, int, int), PaintActionCapsule(ActionListener, Color, Dimension), PaintActionCapsule(ActionListener, Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener a,
                          Color c)
Constructs a component with the given foreground color that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
c - foreground color for component
See Also:
PaintActionCapsule(ActionListener), PaintActionCapsule(ActionListener, Dimension), PaintActionCapsule(ActionListener, int, int), PaintActionCapsule(ActionListener, Color, Dimension), PaintActionCapsule(ActionListener, Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener a,
                          Dimension d)
Constructs a component with the given preferred size that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
d - preferred size for component
See Also:
PaintActionCapsule(ActionListener), PaintActionCapsule(ActionListener, Color), PaintActionCapsule(ActionListener, int, int), PaintActionCapsule(ActionListener, Color, Dimension), PaintActionCapsule(ActionListener, Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener a,
                          int width,
                          int height)
Constructs a component with the given preferred dimensions that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
width - preferred width for component
height - preferred height for component
See Also:
PaintActionCapsule(ActionListener), PaintActionCapsule(ActionListener, Color), PaintActionCapsule(ActionListener, Dimension), PaintActionCapsule(ActionListener, Color, Dimension), PaintActionCapsule(ActionListener, Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener a,
                          Color c,
                          Dimension d)
Constructs a component with the given foreground color and preferred size that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
c - foreground color for component
d - preferred size for component
See Also:
PaintActionCapsule(ActionListener), PaintActionCapsule(ActionListener, Color), PaintActionCapsule(ActionListener, Dimension), PaintActionCapsule(ActionListener, int, int), PaintActionCapsule(ActionListener, Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener a,
                          Color c,
                          int width,
                          int height)
Constructs a component with the given foreground color and preferred dimensions that performs the given action listener each time it is painted.

Parameters:
a - action listener to perform
c - foreground color for component
width - preferred width for component
height - preferred height for component
See Also:
PaintActionCapsule(ActionListener), PaintActionCapsule(ActionListener, Color), PaintActionCapsule(ActionListener, Dimension), PaintActionCapsule(ActionListener, int, int), PaintActionCapsule(ActionListener, Color, Dimension)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a)
Constructs a component that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
See Also:
PaintActionCapsule(ActionListener[], Color), PaintActionCapsule(ActionListener[], Dimension), PaintActionCapsule(ActionListener[], int, int), PaintActionCapsule(ActionListener[], Color, Dimension), PaintActionCapsule(ActionListener[], Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a,
                          Color c)
Constructs a component with the given foreground color that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
c - foreground color for component
See Also:
PaintActionCapsule(ActionListener[]), PaintActionCapsule(ActionListener[], Dimension), PaintActionCapsule(ActionListener[], int, int), PaintActionCapsule(ActionListener[], Color, Dimension), PaintActionCapsule(ActionListener[], Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a,
                          Dimension d)
Constructs a component with the given preferred size that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
d - preferred size for component
See Also:
PaintActionCapsule(ActionListener[]), PaintActionCapsule(ActionListener[], Color), PaintActionCapsule(ActionListener[], int, int), PaintActionCapsule(ActionListener[], Color, Dimension), PaintActionCapsule(ActionListener[], Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a,
                          int width,
                          int height)
Constructs a component with the given preferred size that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
width - preferred width for component
height - preferred height for component
See Also:
PaintActionCapsule(ActionListener[]), PaintActionCapsule(ActionListener[], Color), PaintActionCapsule(ActionListener[], Dimension), PaintActionCapsule(ActionListener[], Color, Dimension), PaintActionCapsule(ActionListener[], Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a,
                          Color c,
                          Dimension d)
Constructs a component with the given foreground color and preferred size that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
c - foreground color for component
d - preferred size for component
See Also:
PaintActionCapsule(ActionListener[]), PaintActionCapsule(ActionListener[], Color), PaintActionCapsule(ActionListener[], Dimension), PaintActionCapsule(ActionListener[], int, int), PaintActionCapsule(ActionListener[], Color, int, int)

PaintActionCapsule

public PaintActionCapsule(ActionListener[] a,
                          Color c,
                          int width,
                          int height)
Constructs a component with the given foreground color and preferred dimensions that performs the given action listeners each time it is painted.

Parameters:
a - array of action listeners to perform
c - foreground color for component
width - preferred width for component
height - preferred height for component
See Also:
PaintActionCapsule(ActionListener[]), PaintActionCapsule(ActionListener[], Color), PaintActionCapsule(ActionListener[], Dimension), PaintActionCapsule(ActionListener[], int, int), PaintActionCapsule(ActionListener[], Color, Dimension)
Method Detail

getActionSequence

public ActionSequence getActionSequence()
Returns the sequence of action listeners performed when this component is painted.

See Also:
setActionSequence(ActionSequence)

setActionSequence

public void setActionSequence(ActionSequence sequence)
Sets the sequence of action listeners performed when this component is painted to the given sequence of action listeners. If the given sequence of action listeners is null, the sequence of action listeners performed when this component is painted is set to a new empty sequence.

Parameters:
sequence - sequence of action listeners to perform
See Also:
getActionSequence()

addAction

public void addAction(ActionListener a)
Adds the given action listener to the end of the sequence of action listeners performed when this component is painted. If the given action is null, the sequence of action listeners is not changed.

Parameters:
a - action listener to add to the sequence of action listeners
See Also:
addActions(ActionListener[]), setAction(ActionListener), setActions(ActionListener[])

addActions

public void addActions(ActionListener[] a)
Adds the action listeners in the given array, in order, to the end of the sequence of action listeners performed when this component is painted. If the given array is null, the sequence of action listeners is not changed.

See Also:
addAction(ActionListener), setAction(ActionListener), setActions(ActionListener[])

removeAction

public boolean removeAction(ActionListener a)
Removes the first occurrence of the given action listener in the sequence of action listeners performed when this component is painted, and returns true, or returns false if the sequence does not contain the action listener. If the given action listener is not in the sequence, the sequence is not changed.

Parameters:
a - action listener to no longer perform
Returns:
the action that was removed

setAction

public void setAction(ActionListener a)
Sets the action performed when this component is painted to the given action listener. The existing sequence of action listeners is eliminated. If the given action listener is null, the sequence of action listeners performed when this component is painted is set to a new empty sequence.

Parameters:
a - action listener to perform
See Also:
setActions(ActionListener[]), addAction(ActionListener), addActions(ActionListener[])

setActions

public void setActions(ActionListener[] a)
Sets the action listeners performed when this component is painted to the action listeners in the given array, in order. The existing sequence of action listeners is eliminated. If the given array is null, the sequence of action listeners performed when this component is painted is set to a new empty sequence.

Parameters:
a - array of action listeners to perform
See Also:
setAction(ActionListener), addAction(ActionListener), addActions(ActionListener[])

paintComponent

protected final void paintComponent(Graphics g)
Performs the stored sequence of action listeners.

Parameters:
g - graphics context on which to paint