Class Towers2
Class Towers2
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----java.applet.Applet
|
+----Towers2
- public class Towers2 (View complete Source)
- extends Applet
-
Towers2()
-
-
init()
-
-
mouseDown(Event, int, int)
- "Pick up" disk -- Figure out which tower region we are in.
-
mouseDrag(Event, int, int)
- Drag disk across screen, along with the mouse cursor.
-
mouseMove(Event, int, int)
-
-
mouseUp(Event, int, int)
- "Drop" disk -- Determine which tower's region we are in and whether or not move is valid,
and then place the disk.
-
paint(Graphics)
-
-
update(Graphics)
- Handles double-buffering.
Towers2
public Towers2()
init
public void init()
- Overrides:
- init in class Applet
update
public synchronized void update(Graphics g)
- Handles double-buffering.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Overrides:
- paint in class Component
mouseMove
public boolean mouseMove(Event evt,
int x,
int y)
- Overrides:
- mouseMove in class Component
mouseDrag
public boolean mouseDrag(Event evt,
int x,
int y)
- Drag disk across screen, along with the mouse cursor.
- Overrides:
- mouseDrag in class Component
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
- "Pick up" disk -- Figure out which tower region we are in. If tower not empty,
1) Take top disk off of tower,
2) Set "From" pointer to that tower,
3) Set "Holding_Disk" flag to true,
4) Repaint the screen.
- Overrides:
- mouseDown in class Component
mouseUp
public boolean mouseUp(Event evt,
int x,
int y)
- "Drop" disk -- Determine which tower's region we are in and whether or not move is valid,
and then place the disk.
- Overrides:
- mouseUp in class Component