Class Bar

Class Bar

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----Bar

class Bar
extends Canvas

Constructor Index

 o Bar(int, int)
Constructs a Bar with button count and direction

Method Index

 o clearCell(Graphics, int)
clear button
 o getButtonIndex(int, int)
get button's index by position
 o getCellInterior(int, boolean)
get drawing area of a button
 o getCellPos(int)
get left top point of button's area
 o getCellRect(int)
get area of a button
 o getDimension()
 o isButtonUp(int)
return the button state
 o mouseDown(Event, int, int)
 o mouseMove(Event, int, int)
 o paint(Graphics)
set help string
 o pressButton(int)
called when mouse downd the button

Constructors

 o Bar
  public Bar(int count,
             int direction)
Constructs a Bar with button count and direction
Parameters:
count - : button's count
direction - : bars direction (VERTICAL, HORIZONTAL)

Methods

 o pressButton
  public abstract void pressButton(int i)
called when mouse downd the button
Parameters:
g - : graphics
i - : button index in Bar
rc - : drawing area
 o isButtonUp
  public abstract boolean isButtonUp(int i)
return the button state
Parameters:
i - : button index in Bar
Returns:
: true if button is up state
 o getDimension
  public Dimension getDimension()
 o paint
  public void paint(Graphics g)
set help string
Parameters:
help - : help String
Overrides:
paint in class Canvas
 o clearCell
  public void clearCell(Graphics g,
                        int i)
clear button
Parameters:
g - : graphics
i - : button index in Bar
 o getCellRect
  public Rectangle getCellRect(int i)
get area of a button
Parameters:
i - : button index in Bar
Returns:
button's area
 o getCellInterior
  public Rectangle getCellInterior(int i,
                                   boolean isUp)
get drawing area of a button
Parameters:
i - : button index in Bar
isUp - : state of button
Returns:
button's area
 o getCellPos
  public Point getCellPos(int i)
get left top point of button's area
Parameters:
i - : button index in Bar
Returns:
left top point of button's area
 o getButtonIndex
  protected int getButtonIndex(int x,
                               int y)
get button's index by position
Parameters:
x: - x position
y: - y position
Returns:
button's index
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Overrides:
mouseDown in class Component
 o mouseMove
  public boolean mouseMove(Event e,
                           int x,
                           int y)
Overrides:
mouseMove in class Component