All Packages Class Hierarchy This Package Previous Next Index
Class jclass.bwt.JCLabel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----jclass.bwt.JCComponent
|
+----jclass.bwt.JCLabel
- public class JCLabel
- extends JCComponent
A component that displays multiple lines of read-only text and/or images.
Properties
overridden JCComponent fields
Name New value Reference
highlight 0 setHighlightThicknss
insets (2,5,2,5) setInsets
shadow 0 shadow
traversable false setTraversable
-
BOTTOMCENTER
-
-
BOTTOMLEFT
-
-
BOTTOMRIGHT
-
-
CENTER
-
-
label_height
-
-
label_rect
-
-
label_width
-
-
LEFT
-
-
MIDDLE
-
-
MIDDLECENTER
-
-
MIDDLELEFT
-
-
MIDDLERIGHT
-
-
RIGHT
-
-
SHADOW_ETCHED_IN
-
-
SHADOW_ETCHED_OUT
-
-
SHADOW_FRAME_IN
-
-
SHADOW_FRAME_OUT
-
-
SHADOW_IN
-
-
SHADOW_NONE
-
-
SHADOW_OUT
-
-
SHADOW_PLAIN
-
-
TOPCENTER
-
-
TOPLEFT
-
-
TOPRIGHT
-
-
url
- The url that the mouse is currently over.
-
JCLabel()
- Creates an empty label.
-
JCLabel(Object)
- Creates a label with the specified text.
-
JCLabel(Object, Applet, String)
- Creates a label which reads parameters from the applet's HTML file.
-
JCLabel(String, Image, int)
- Creates a label from a String and an Image.
-
JCLabel(String, String, Applet, int)
- Creates a label constructed from a String and an Image file.
-
addNotify()
- Creates the peer of the canvas.
-
drawValue(Graphics, Object)
- Draws the interior value.
-
getAlignment()
- Gets the label's alignment.
-
getLabel()
- Gets the label's value.
-
getLabelBounds()
- Gets the bounding rectangle for the label value.
-
getLabelImage()
- Gets the URL which was used to create the label's image.
-
getParameters()
- Reads the parameter values from the HTML page using the component's applet.
-
getShadowType()
- Gets the shadow style.
-
getText()
- Gets the text of this label as a String.
-
getTextList()
- Gets the text of this label as a String list.
-
layout()
- Lays out the component's internal elements.
-
layout(Object)
- Lays out the label's internal elements, using the specified value.
-
mouseMove(Event, int, int)
- If the label is being displayed in a browser and the mouse is over an URL,
the cursor is changed.
-
mouseUp(Event, int, int)
- If the mouse is over an URL, display it.
-
paintComponent(Graphics)
- Draws value.
-
preferredHeight()
- Gets the subclass' preferred height (default: 100).
-
preferredWidth()
- Gets the subclass' preferred width (default: 100).
-
setAlignment(int)
- Sets the position of the value within the label:
Label.LEFT, CENTER or RIGHT; or
JCLabel.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER (default), MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT.
HTML param name/value: "Alignment"/enum
-
setFont(Font)
- Sets the label's font.
-
setLabel(Object)
- Sets the value displayed in the label.
HTML param name/value: "Label"/string
-
setLabelImage(URL)
- Sets the text for this label to the specified image.
-
setLabelSize(Object)
- Set the value's size internally, for use in layout().
-
setLabelSize(Object, Font)
- Set the value's size internally, for use in layout().
-
setShadowType(int)
- Sets the shadow style.
-
setText(String)
- Sets the text for this label to the specified text.
-
setTextList(String[])
- Sets the text for this label to the specified String list.
TOPLEFT
public static final int TOPLEFT
LEFT
public static final int LEFT
TOPCENTER
public static final int TOPCENTER
CENTER
public static final int CENTER
TOPRIGHT
public static final int TOPRIGHT
RIGHT
public static final int RIGHT
MIDDLELEFT
public static final int MIDDLELEFT
MIDDLECENTER
public static final int MIDDLECENTER
MIDDLE
public static final int MIDDLE
MIDDLERIGHT
public static final int MIDDLERIGHT
BOTTOMLEFT
public static final int BOTTOMLEFT
BOTTOMCENTER
public static final int BOTTOMCENTER
BOTTOMRIGHT
public static final int BOTTOMRIGHT
SHADOW_NONE
public static final int SHADOW_NONE
SHADOW_ETCHED_IN
public static final int SHADOW_ETCHED_IN
SHADOW_ETCHED_OUT
public static final int SHADOW_ETCHED_OUT
SHADOW_IN
public static final int SHADOW_IN
SHADOW_OUT
public static final int SHADOW_OUT
SHADOW_PLAIN
public static final int SHADOW_PLAIN
SHADOW_FRAME_IN
public static final int SHADOW_FRAME_IN
SHADOW_FRAME_OUT
public static final int SHADOW_FRAME_OUT
label_width
protected int label_width
label_height
protected int label_height
label_rect
protected Rectangle label_rect
url
protected transient String url
- The url that the mouse is currently over.
JCLabel
public JCLabel()
- Creates an empty label. No parameters are read from an HTML file.
JCLabel
public JCLabel(Object label)
- Creates a label with the specified text.
No parameters are read from an HTML file.
- See Also:
- setLabel
JCLabel
public JCLabel(String s,
Image image,
int layout)
- Creates a label from a String and an Image.
- Parameters:
- layout - the relative position of the string with respect to the image:
BWTEnum.STRING_LEFT, STRING_RIGHT, STRING_TOP or STRING_BOTTOM
JCLabel
public JCLabel(String s,
String image,
Applet applet,
int layout)
- Creates a label constructed from a String and an Image file.
- Parameters:
- applet - the applet that is loading the image. If the applet
is in a browser, Applet.getImage() is used in order to take
advantage of Applet.getDocumentBase()
- image - the file containing the image to be loaded; if an http protocol
is not specified (a ":" is not present), the current document base or
working directory is prepended to the file name
- layout - the relative position of the string with respect to the image:
BWTEnum.STRING_LEFT, STRING_RIGHT, STRING_TOP or STRING_BOTTOM
JCLabel
public JCLabel(Object label,
Applet applet,
String name)
- Creates a label which reads parameters from the applet's HTML file.
- Parameters:
- label - the initial label
- applet - the applet whose PARAM tags are to be read
- name - if this is not null, only parameters preceded by this name are read
- See Also:
- setLabel, getParameter
getParameters
protected void getParameters()
- Reads the parameter values from the HTML page using the component's applet.
The values will override those previously set.
- Overrides:
- getParameters in class JCComponent
getAlignment
public int getAlignment()
- Gets the label's alignment.
- See Also:
- setAlignment
setAlignment
public void setAlignment(int v)
- Sets the position of the value within the label:
Label.LEFT, CENTER or RIGHT; or
JCLabel.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER (default), MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT.
HTML param name/value: "Alignment"/enum
- Throws: IllegalArgumentException
- If an invalid value is set
setFont
public synchronized void setFont(Font f)
- Sets the label's font.
- Overrides:
- setFont in class JCComponent
getLabel
public Object getLabel()
- Gets the label's value.
- See Also:
- setLabel
setLabel
public void setLabel(Object v)
- Sets the value displayed in the label.
HTML param name/value: "Label"/string
- Parameters:
- v - a String, Image, JCString, or any object (in which case the object's
toString() method is called to obtain a string).
- See Also:
- JCString, toJCString
getText
public String getText()
- Gets the text of this label as a String.
- See Also:
- setText
setText
public void setText(String label)
- Sets the text for this label to the specified text.
- See Also:
- getText
getTextList
public String[] getTextList()
- Gets the text of this label as a String list.
- See Also:
- setTextList
setTextList
public void setTextList(String l[])
- Sets the text for this label to the specified String list. This creates
a multi-line label.
- See Also:
- getTextList
getLabelImage
public URL getLabelImage()
- Gets the URL which was used to create the label's image.
- Returns:
- null if the label was not set using an URL
- See Also:
- setLabelImage
setLabelImage
public void setLabelImage(URL label)
- Sets the text for this label to the specified image.
getShadowType
public int getShadowType()
- Gets the shadow style.
- See Also:
- setShadowType
setShadowType
public void setShadowType(int v)
- Sets the shadow style. Valid values are:
SHADOW_ETCHED_IN double line; label appears inset
SHADOW_ETCHED_OUT double line; label appears raised
SHADOW_FRAME_IN 1-pixel shadow-in at edge; label appears framed
SHADOW_FRAME_OUT 1-pixel shadow-out at edge; label appears framed
SHADOW_IN label appears inset (default)
SHADOW_OUT label appears raised
SHADOW_PLAIN shadow drawn in foreground color
SHADOW_NONE no shadow
The width of the shadow is specified by ShadowThickness, which must be greater
than 5 pixels to see the effects of the ETCHED and FRAME shadows.
Note that the default thickness is 0, so no shadow is drawn.
- See Also:
- setShadowThickness
drawValue
protected synchronized void drawValue(Graphics gc,
Object value)
- Draws the interior value.
paintComponent
protected void paintComponent(Graphics gc)
- Draws value.
- Overrides:
- paintComponent in class JCComponent
setLabelSize
protected void setLabelSize(Object value)
- Set the value's size internally, for use in layout().
- See Also:
- layout
setLabelSize
protected void setLabelSize(Object value,
Font font)
- Set the value's size internally, for use in layout().
- See Also:
- layout
addNotify
public void addNotify()
- Creates the peer of the canvas.
- Overrides:
- addNotify in class JCComponent
preferredWidth
protected int preferredWidth()
- Gets the subclass' preferred width (default: 100).
- Overrides:
- preferredWidth in class JCComponent
preferredHeight
protected int preferredHeight()
- Gets the subclass' preferred height (default: 100).
- Overrides:
- preferredHeight in class JCComponent
getLabelBounds
public Rectangle getLabelBounds()
- Gets the bounding rectangle for the label value.
- See Also:
- setText
layout
public synchronized void layout()
- Lays out the component's internal elements.
- Overrides:
- layout in class JCComponent
layout
protected void layout(Object value)
- Lays out the label's internal elements, using the specified value.
mouseMove
public boolean mouseMove(Event ev,
int x,
int y)
- If the label is being displayed in a browser and the mouse is over an URL,
the cursor is changed.
- Overrides:
- mouseMove in class Component
mouseUp
public boolean mouseUp(Event ev,
int x,
int y)
- If the mouse is over an URL, display it.
- Overrides:
- mouseUp in class Component
All Packages Class Hierarchy This Package Previous Next Index