uavsim.graphics.controls.buttons
Class A_Button

java.lang.Object
  extended by uavsim.graphics.controls.A_Control
      extended by uavsim.graphics.controls.buttons.A_Button
Direct Known Subclasses:
PushButton

public abstract class A_Button
extends A_Control

Provides the shared functionality of a basic interactive pushbutton.

Author:
Dan Tappan [22.06.11]

Field Summary
protected  Box _body
          the button body.
protected  ButtonProperties _properties
          the button properties
 
Fields inherited from class uavsim.graphics.controls.A_Control
_id, CURSOR_ARROW_DOWN, CURSOR_ARROW_LEFT, CURSOR_ARROW_RIGHT, CURSOR_ARROW_UP, CURSOR_CROSSHAIR, CURSOR_DEFAULT, CURSOR_HAND
 
Constructor Summary
A_Button(java.lang.String id, ButtonProperties properties, A_Instrument hostInstrument)
          Creates an abstract button control.
 
Method Summary
 ButtonProperties getProperties()
          Gets the button properties.
 boolean handleMouseEvent_(java.awt.event.MouseEvent mouseEvent)
          Handles a mouse event.
protected  boolean isCoordinateHit(CoordinateCartesianAbsolute point)
          Determines whether a screen coordinate is contained within the bounds of this control.
 void render(java.awt.Graphics2D graphics)
          Renders the controls.
 java.lang.String toString()
          
 
Methods inherited from class uavsim.graphics.controls.A_Control
calculateAnchor, getHostInstrument, getID, resetCursor, setCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_body

protected Box _body
the button body. This initial object serves as a placeholder until render() supplies the real one based on the actual size


_properties

protected final ButtonProperties _properties
the button properties

Constructor Detail

A_Button

public A_Button(java.lang.String id,
                ButtonProperties properties,
                A_Instrument hostInstrument)
Creates an abstract button control.

Parameters:
id - - the unique button identifier
properties - - the button properties
hostInstrument - - the button host instrument
Method Detail

getProperties

public ButtonProperties getProperties()
Gets the button properties.

Returns:
the properties

handleMouseEvent_

public boolean handleMouseEvent_(java.awt.event.MouseEvent mouseEvent)
Handles a mouse event.

Specified by:
handleMouseEvent_ in class A_Control
Parameters:
mouseEvent - - the event
Returns:
whether the mouse hovered over this control

isCoordinateHit

protected boolean isCoordinateHit(CoordinateCartesianAbsolute point)
Determines whether a screen coordinate is contained within the bounds of this control.

Specified by:
isCoordinateHit in class A_Control
Parameters:
point - - the coordinate
Returns:
the result

render

public void render(java.awt.Graphics2D graphics)
Renders the controls.

Overrides:
render in class A_Control
Parameters:
graphics - - the graphics context

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object