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
-
ClickableLabel(String)
- Most classes will use this constructor method.
-
ClickableLabel(String, boolean)
- This constructor method is only used by ClickableLabels
placed in the BreedFrame.
-
getLabel()
- Accessor method for the label.
-
minimumSize()
- Defines the minimum size to be the same the preferred size
-
mouseDown(Event, int, int)
- Detect MOUSE_DOWN events and create a new CTRL_CLICK
event defined in the ControlClickEvent class.
-
paint(Graphics)
- Draw the label on the canvas.
-
paramString()
- Create the event argument
-
preferredSize()
- Calculate the preferred size based on the current font settings
-
reshape(int, int, int, int)
- Reshape the label
-
resize(int, int)
- Specify a new width and height for the label
-
setInsets(Insets)
- Change the insets
ClickableLabel
public ClickableLabel(String label)
- Most classes will use this constructor method. It simply
assigns the string label.
- Parameters:
- label - the string label
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
paint
public void paint(Graphics g)
- Draw the label on the canvas.
- Parameters:
- g - the Graphics objbect
- Overrides:
- paint in class Canvas
setInsets
public void setInsets(Insets insets)
- Change the insets
- Parameters:
- insets - the new inset values
getLabel
public String getLabel()
- Accessor method for the label.
- Returns:
- the label
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
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
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
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
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
paramString
protected String paramString()
- Create the event argument
- Overrides:
- paramString in class Component