org.rr0.is.presentation.view.report.applet
Class ShapeButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--org.rr0.is.presentation.view.report.applet.ShapeButton
Direct Known Subclasses:
DrawShapeButton, PolygonButton

public abstract class ShapeButton
extends Canvas
implements MouseListener

A on/off button that displays a Shape.


This class is implemented to be usable in Java 1.1 applets, and so follows an AWT-only requirement
(no Swing, Java2D, geom, or Java 2 feature)


Because of the graphics to be drawn on it, this button inherits from java.awt.Canvas and not from java.awt.Button
(of which the peer cannot be overwritten on every platform)

Author:
Jerôme Beau
Version: 24 oct. 2003 16:36:35

Field Summary
 private VectoractionListeners
           
 private final static intDEFAULT_MARGIN
           
 private Dimensiondimension
           
 private ColorenabledColor
           
 private StringhoverMessage
           
 private intmargin
           
 private VectormessageListeners
           
 private booleanstate
          The on/off state of the button

Fields inherited from class java.awt.Component
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT

Constructor Summary
 ShapeButton()
           
 protected ShapeButton(String hoverMessage)
           

Method Summary
 voidaddActionListener(ActionListener actionListener)
           
 voidaddMessageListener(MessageListener messageListener)
           
 private voidfire(String message)
           
 protected intgetMargin()
           
 DimensiongetPreferredSize()
           
 booleanisPushed()
           
 protected voidmessage(String message)
          Send a text message to our message listeners.
 voidmouseClicked(MouseEvent e)
          Invoked when the mouse button has been clicked (pressed
and released) on a component.
 voidmouseEntered(MouseEvent e)
          Invoked when the mouse enters a component.
 voidmouseExited(MouseEvent e)
          Invoked when the mouse exits a component.
 voidmousePressed(MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 voidmouseReleased(MouseEvent e)
          Invoked when a mouse button has been released on a component.
 voidpaint(Graphics g)
           
 voidpushed()
           
 voidreleased()
           
 voidsetEnabled(boolean b)
           
 voidsetHoverMessage(String hoverMessage)
           
 voidsetMargin(int margin)
           
 voidsetShapeDimension(Dimension shapeDimension)
           

Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext

Methods inherited from class java.awt.Component
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getGraphicsConfiguration, getTreeLock, getToolkit, isValid, isDisplayable, isVisible, isShowing, isEnabled, enable, enable, disable, isDoubleBuffered, enableInputMethods, setVisible, show, show, hide, getForeground, setForeground, getBackground, setBackground, getFont, setFont, getLocale, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, reshape, setBounds, getX, getY, getWidth, getHeight, getBounds, getSize, getLocation, isOpaque, isLightweight, preferredSize, getMinimumSize, minimumSize, getMaximumSize, getAlignmentX, getAlignmentY, doLayout, layout, validate, invalidate, getGraphics, getFontMetrics, setCursor, getCursor, update, paintAll, repaint, repaint, repaint, repaint, print, printAll, imageUpdate, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, contains, inside, contains, getComponentAt, locate, getComponentAt, deliverEvent, dispatchEvent, postEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getListeners, getInputMethodRequests, getInputContext, enableEvents, disableEvents, coalesceEvents, processEvent, processComponentEvent, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, removeNotify, gotFocus, lostFocus, isFocusTraversable, requestFocus, transferFocus, nextFocus, hasFocus, add, remove, paramString, toString, list, list, list, list, list, addPropertyChangeListener, removePropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, firePropertyChange, setComponentOrientation, getComponentOrientation

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize

Field Detail

actionListeners

private Vector actionListeners

DEFAULT_MARGIN

private final static int DEFAULT_MARGIN

dimension

private Dimension dimension

enabledColor

private Color enabledColor

hoverMessage

private String hoverMessage

margin

private int margin

messageListeners

private Vector messageListeners

state

private boolean state
The on/off state of the button
Constructor Detail

ShapeButton

public ShapeButton()

ShapeButton

protected ShapeButton(String hoverMessage)
Method Detail

addActionListener

public void addActionListener(ActionListener actionListener)

addMessageListener

public void addMessageListener(MessageListener messageListener)

fire

private void fire(String message)

getMargin

protected int getMargin()

getPreferredSize

public Dimension getPreferredSize()

isPushed

public boolean isPushed()

message

protected void message(String message)
Send a text message to our message listeners.
Parameters:
message

mouseClicked

public void mouseClicked(MouseEvent e)
Invoked when the mouse button has been clicked (pressed
and released) on a component.

mouseEntered

public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.

mouseExited

public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.

mousePressed

public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.

mouseReleased

public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.

paint

public void paint(Graphics g)

pushed

public void pushed()

released

public void released()

setEnabled

public void setEnabled(boolean b)

setHoverMessage

public void setHoverMessage(String hoverMessage)

setMargin

public void setMargin(int margin)

setShapeDimension

public void setShapeDimension(Dimension shapeDimension)

Association Links

to Class java.awt.Dimension

to Class java.util.Vector

to Class java.util.Vector

to Class java.awt.Color

to Class java.lang.String