Class Button

Class Button

java.lang.Object
   |
   +----Button

class Button
extends Object
Button is the main class for creating buttons.
See Also:
ToggleButton, MEXButton, MEXButtonList

Variable Index

 o app
Static pointer to the main applet.

Constructor Index

 o Button(int, String, int, int, int, int, Font)
Creates a button.

Method Index

 o GetNum()
Gets the id-number of this button.
 o action()
Main scheduling function.
 o drawAll(Graphics)
Redraw all buttons.
 o drawButton(Graphics)
 o drawChanged(Graphics)
Redraw only these buttons, which are changed since the last redraw.
 o freeAll()
Deletes all buttons.
 o mouseDown(int, int)
Handels a mouse click.
 o mouseDrag(int, int)
Handels a mouse drag event.
 o mouseUp(int, int)
Handels a mouse up event.
 o mouseUpButton(int, int)

Variables

 o app
  public static Dance app
Static pointer to the main applet. Has to be set before the first use of a button.

Constructors

 o Button
  public Button(int bnum,
                String l,
                int x,
                int y,
                int w,
                int h,
                Font f)
Creates a button.
Parameters:
bnum - id-number for the button
l - label
x - x-ccordinate of the button
y - y-coordinate of the button
w - the size().width
h - the size().height
f - the font used for the label

Methods

 o freeAll
  public static void freeAll()
Deletes all buttons.
 o drawAll
  public static void drawAll(Graphics g)
Redraw all buttons.
 o drawChanged
  public static void drawChanged(Graphics g)
Redraw only these buttons, which are changed since the last redraw.
 o mouseDown
  public static boolean mouseDown(int x,
                                  int y)
Handels a mouse click. Normaly called from the applet. If something has changed, java.applet.Applet.repaint() will be called.
 o mouseUp
  public static boolean mouseUp(int x,
                                int y)
Handels a mouse up event. Normaly called from the applet. If something has changed java.applet.Applet.repaint() will be called. If the mouse down and the mouse up event was over the same button, the action function of this button will be called.
 o mouseDrag
  public static boolean mouseDrag(int x,
                                  int y)
Handels a mouse drag event. Normaly called from the applet. If something has changed java.applet.Applet.repaint() will be called.
 o GetNum
  public int GetNum()
Gets the id-number of this button.
Returns:
id-number of this button.
 o drawButton
  protected void drawButton(Graphics g)
 o mouseUpButton
  protected boolean mouseUpButton(int x,
                                  int y)
 o action
  protected void action()
Main scheduling function. Will be called if an button is correctly pressed (mouse down and up).