uk.org.arlott.simon.hw.f24.lbsta
Interface CommonInterface

All Known Implementing Classes:
NetworkEdit, NetworkView, ScriptEdit

public interface CommonInterface

The CommonInterface interface provides methods to allow multiple application modes to all support certain input event methods. The purpose is to define commonly required methods like mouse movement and clicking handling as well as redrawing the display.


Field Summary
static int MOUSE_PRIMARY
          The primary mouse button (usually the left).
static int MOUSE_SECONDARY
          The secondary mouse button (usually the right).
 
Method Summary
 void hide()
          Switch from this mode.
 boolean keyPressed(int keyCode)
          Indicates that a key has been pressed.
 boolean mouseClick(int button, java.lang.Object hover)
          Indicates that a mouse button has been clicked.
 boolean mouseMoved(java.awt.Point position, java.lang.Object hover)
          Indicates that the mouse has been moved.
 void paint(java.awt.Graphics g, java.awt.Dimension size)
          Called after the network has been drawn to allow custom drawing to take place.
 void show()
          Switch to this mode.
 

Field Detail

MOUSE_PRIMARY

static final int MOUSE_PRIMARY
The primary mouse button (usually the left).

See Also:
Constant Field Values

MOUSE_SECONDARY

static final int MOUSE_SECONDARY
The secondary mouse button (usually the right).

See Also:
Constant Field Values
Method Detail

mouseClick

boolean mouseClick(int button,
                   java.lang.Object hover)
Indicates that a mouse button has been clicked.

Parameters:
button - The button pressed, either MOUSE_PRIMARY or MOUSE_SECONDARY.
hover - The object, if any, that the mouse pointer is hovering over at the time.
Returns:
A boolean indicating if the display should be redrawn or not.

mouseMoved

boolean mouseMoved(java.awt.Point position,
                   java.lang.Object hover)
Indicates that the mouse has been moved.

Parameters:
position - The position of the mouse pointer.
hover - The object, if any, that the mouse pointer is hovering over at the time.
Returns:
A boolean indicating if the display should be redrawn or not.

keyPressed

boolean keyPressed(int keyCode)
Indicates that a key has been pressed.

Parameters:
keyCode - The KeyCode.getKeyCode() value.
Returns:
A boolean indicating if the display should be redrawn or not.

paint

void paint(java.awt.Graphics g,
           java.awt.Dimension size)
Called after the network has been drawn to allow custom drawing to take place.

Parameters:
g - The Graphics object to draw to.
size - The visible area of the panel to be drawn on.

show

void show()
Switch to this mode.


hide

void hide()
Switch from this mode.