AFLPgui
Class ImgButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Button
              |
              +--AFLPgui.ImgButton
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.io.Serializable

public class ImgButton
extends java.awt.Button
implements java.awt.event.MouseListener

A button with an image on it. The image position is adjusted when the button is pressed, and then moved back when it is released. The image is drawn at (2, 2) when the button is "up" and (3, 3) when it is "down".

See Also:
Serialized Form

Inner classes inherited from class java.awt.Button
java.awt.Button.AccessibleAWTButton
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Image image
           
 
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
ImgButton(java.awt.Image img)
          Creates a new ImgButton with the specified image.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent e)
          Unused
 void mouseEntered(java.awt.event.MouseEvent e)
          Unused
 void mouseExited(java.awt.event.MouseEvent e)
          Moves the image position back to it's normal state.
 void mousePressed(java.awt.event.MouseEvent e)
          Shifts the image position down and to the right.
 void mouseReleased(java.awt.event.MouseEvent e)
          Moves the image position back to it's normal state.
 void paint(java.awt.Graphics g)
          Draws the button.
 
Methods inherited from class java.awt.Button
addActionListener, addNotify, getAccessibleContext, getActionCommand, getLabel, getListeners, paramString, processActionEvent, processEvent, removeActionListener, setActionCommand, setLabel
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, 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, getGraphicsConfiguration, 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, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, 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, notify, notifyAll, wait, wait, wait
 

Field Detail

image

protected java.awt.Image image
Constructor Detail

ImgButton

public ImgButton(java.awt.Image img)
Creates a new ImgButton with the specified image.
Parameters:
img - the image for the button to display on it's face.
Method Detail

paint

public void paint(java.awt.Graphics g)
Draws the button. The super class handles all of the drawing except for the image. The image is drawn at a position depending on it's state. If the button is "pressed" the image is drawn lower and farther to the right.
Overrides:
paint in class java.awt.Component
Parameters:
g - the graphics object to draw on.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Unused
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Shifts the image position down and to the right. See the class description for the value.
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Moves the image position back to it's normal state.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Unused
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Moves the image position back to it's normal state.
Specified by:
mouseExited in interface java.awt.event.MouseListener