adm
Class ArrowButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--adm.ArrowButton

public class ArrowButton
extends java.awt.Canvas

ArrowButton is custom Button widget. It works just like awt Button.

ArrowButton has four directions defined in CConstants class. The default direction is DIR_UP. It can be set using setDirection method.

Since:
adm1.0
See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ArrowButton()
          Constructor (dufault direction is DIR_UP)
ArrowButton(int dir)
          Constructor with specific direction
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds the specified action listener to receive action events from this button.
 int getDirection()
          Return the direction of the arrow button
 void paint(java.awt.Graphics g)
          Draw the arrow button
 void processMouseEvent(java.awt.event.MouseEvent e)
          Handle the mouse event.
 void removeActionListener(java.awt.event.ActionListener l)
          Removes the specified action listener so that it no longer receives action events from this button.
 void setDirection(int dir)
          set the direction of the button arrow
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, 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, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrowButton

public ArrowButton()
Constructor (dufault direction is DIR_UP)

ArrowButton

public ArrowButton(int dir)
Constructor with specific direction
Parameters:
dir - the button arrow direction, which may be one of:
  1. CConstants.DIR_UP
  2. CConstants.DIR_DOWN
  3. CConstants.DIR_RIGHT
  4. CConstants.DIR_LEFTL
Method Detail

setDirection

public void setDirection(int dir)
set the direction of the button arrow
Parameters:
dir - the arrow direction, which may be one of:
  1. CConstants.DIR_UP
  2. CConstants.DIR_DOWN
  3. CConstants.DIR_RIGHT
  4. CConstants.DIR_LEFTL

getDirection

public int getDirection()
Return the direction of the arrow button

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener to receive action events from this button. Action events occur when a user presses or releases the mouse over this button.
Parameters:
l - the action listener.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener so that it no longer receives action events from this button. Action events occur when a user presses or releases the mouse over this button.
Parameters:
l - the action listener.

paint

public final void paint(java.awt.Graphics g)
Draw the arrow button
Overrides:
paint in class java.awt.Canvas

processMouseEvent

public void processMouseEvent(java.awt.event.MouseEvent e)
Handle the mouse event. Release the mouse to generate the ActionEvent