| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--java.awt.Component
|
+--ncsa.horizon.awt.ImageButton
| Field Summary | |
| boolean | overButton
The overButton variable is set if the mouse enters |
| boolean | pressed
The pressed variable is set if the mouse clicks |
| Fields inherited from class java.awt.Component | |
| BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | |
| Constructor Summary | |
| ImageButton(java.awt.Image mouseOffImage,
java.awt.Image mouseOnImage,
int borderThickness)
Constructs an image button with specified images and borders |
|
| Method Summary | |
| void | addActionListener(java.awt.event.ActionListener listener)
Adds the specified action listener to receive action events from this button. |
| java.awt.Dimension | getMinimumSize()
The minimum size of the button. |
| java.awt.Dimension | getPreferredSize()
The preferred size of the button. |
| void | paint(java.awt.Graphics g)
paints the button |
| void | processMouseEvent(java.awt.event.MouseEvent e)
Paints the button and sends an action event to all listeners. |
| void | processMouseMotionEvent(java.awt.event.MouseEvent e)
The processMouseMotionEvent function is necessary because other mouse events do not take care of drags that release outside of the button's x,y. |
| void | removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener so it no longer receives action events from this button. |
| Methods inherited from class java.awt.Component | |
| action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate | |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
protected boolean pressed
protected boolean overButton
| Constructor Detail |
public ImageButton(java.awt.Image mouseOffImage,
java.awt.Image mouseOnImage,
int borderThickness)
mouseOnImage
- The image used when the mouse cursor is On the button
mouseOffImage
- The image used when the mouse cursor is Off the button
borderThickness
- is the width/height of the 3D border for the button| Method Detail |
public void paint(java.awt.Graphics g)
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public void addActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- the action listenerpublic void processMouseEvent(java.awt.event.MouseEvent e)
Here is the state machine for the various events associated with the image button... Event Graphic used Action Variable set/unset -------------------------------------------------------------------------- MOUSE_PRESSED depends on x,y none pressed, overButton (a safety) MOUSE_RELEASED depends on x,y depends on x, y pressed (unset) MOUSE_EXITED OFF Graphic none overButton (unset) MOUSE_ENTERED ON Graphic none overButton MOUSE_DRAGGED OFF Graphic none pressed, overButton (depends on x,y)
public void processMouseMotionEvent(java.awt.event.MouseEvent e)
| Overview | Package | Class | Tree | Deprecated | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||