Class ClickableLabel

Class ClickableLabel

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

class ClickableLabel
extends Canvas
This class extends Canvas and is used to create a custom component that will detect control mouse clicks on a label. It simply places a label on a canvas and overrides the necessary methods. When a MOUSE_DOWN event occurs on the label, a new event is created and delivered.
See Also:
ControlClickEvent

Constructor Index

 o ClickableLabel(String)
Most classes will use this constructor method.
 o ClickableLabel(String, boolean)
This constructor method is only used by ClickableLabels placed in the BreedFrame.

Method Index

 o getLabel()
Accessor method for the label.
 o minimumSize()
Defines the minimum size to be the same the preferred size
 o mouseDown(Event, int, int)
Detect MOUSE_DOWN events and create a new CTRL_CLICK event defined in the ControlClickEvent class.
 o paint(Graphics)
Draw the label on the canvas.
 o paramString()
Create the event argument
 o preferredSize()
Calculate the preferred size based on the current font settings
 o reshape(int, int, int, int)
Reshape the label
 o resize(int, int)
Specify a new width and height for the label
 o setInsets(Insets)
Change the insets

Constructors

 o ClickableLabel
  public ClickableLabel(String label)
Most classes will use this constructor method. It simply assigns the string label.
Parameters:
label - the string label
 o ClickableLabel
  public ClickableLabel(String label,
                        boolean es)
This constructor method is only used by ClickableLabels placed in the BreedFrame.
Parameters:
label - the string label
es - specifies that we want extra space around the label

Methods

 o paint
  public void paint(Graphics g)
Draw the label on the canvas.
Parameters:
g - the Graphics objbect
Overrides:
paint in class Canvas
 o setInsets
  public void setInsets(Insets insets)
Change the insets
Parameters:
insets - the new inset values
 o getLabel
  public String getLabel()
Accessor method for the label.
Returns:
the label
 o resize
  public void resize(int w,
                     int h)
Specify a new width and height for the label
Parameters:
w - the width
h - the height
Overrides:
resize in class Component
 o reshape
  public void reshape(int x,
                      int y,
                      int w,
                      int h)
Reshape the label
Parameters:
x - the x coordinate
y - the y coordinate
w - the width
h - the height
Overrides:
reshape in class Component
 o minimumSize
  public Dimension minimumSize()
Defines the minimum size to be the same the preferred size
Returns:
the dimensions of the preferred size
Overrides:
minimumSize in class Component
 o preferredSize
  public Dimension preferredSize()
Calculate the preferred size based on the current font settings
Returns:
the dimesions of the preferred size
Overrides:
preferredSize in class Component
 o mouseDown
  public boolean mouseDown(Event event,
                           int x,
                           int y)
Detect MOUSE_DOWN events and create a new CTRL_CLICK event defined in the ControlClickEvent class.
Parameters:
event - the AWT generated event
x - the x coordinate of the mouse location
y - the y coordinate of the mouse location
Overrides:
mouseDown in class Component
 o paramString
  protected String paramString()
Create the event argument
Overrides:
paramString in class Component