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

Name Method
Alignment setAlignment
Background setBackground
DoubleBuffer setDoubleBuffer
Font setFont
Foreground setForeground
HighlightColor setHighlightColor
HighlightThickness setHighlightThickness
Insets setInsets
Label setLabel
PreferredSize setPreferredSize
ShadowThickness setShadowThickness
Traversable setTraversable
UserData setUserData

overridden JCComponent fields

 Name           New value    Reference
 highlight      0            setHighlightThicknss
 insets         (2,5,2,5)    setInsets
 shadow         0            shadow
 traversable    false        setTraversable
 


Variable Index

 o BOTTOMCENTER
 o BOTTOMLEFT
 o BOTTOMRIGHT
 o CENTER
 o label_height
 o label_rect
 o label_width
 o LEFT
 o MIDDLE
 o MIDDLECENTER
 o MIDDLELEFT
 o MIDDLERIGHT
 o RIGHT
 o SHADOW_ETCHED_IN
 o SHADOW_ETCHED_OUT
 o SHADOW_FRAME_IN
 o SHADOW_FRAME_OUT
 o SHADOW_IN
 o SHADOW_NONE
 o SHADOW_OUT
 o SHADOW_PLAIN
 o TOPCENTER
 o TOPLEFT
 o TOPRIGHT
 o url
The url that the mouse is currently over.

Constructor Index

 o JCLabel()
Creates an empty label.
 o JCLabel(Object)
Creates a label with the specified text.
 o JCLabel(Object, Applet, String)
Creates a label which reads parameters from the applet's HTML file.
 o JCLabel(String, Image, int)
Creates a label from a String and an Image.
 o JCLabel(String, String, Applet, int)
Creates a label constructed from a String and an Image file.

Method Index

 o addNotify()
Creates the peer of the canvas.
 o drawValue(Graphics, Object)
Draws the interior value.
 o getAlignment()
Gets the label's alignment.
 o getLabel()
Gets the label's value.
 o getLabelBounds()
Gets the bounding rectangle for the label value.
 o getLabelImage()
Gets the URL which was used to create the label's image.
 o getParameters()
Reads the parameter values from the HTML page using the component's applet.
 o getShadowType()
Gets the shadow style.
 o getText()
Gets the text of this label as a String.
 o getTextList()
Gets the text of this label as a String list.
 o layout()
Lays out the component's internal elements.
 o layout(Object)
Lays out the label's internal elements, using the specified value.
 o mouseMove(Event, int, int)
If the label is being displayed in a browser and the mouse is over an URL, the cursor is changed.
 o mouseUp(Event, int, int)
If the mouse is over an URL, display it.
 o paintComponent(Graphics)
Draws value.
 o preferredHeight()
Gets the subclass' preferred height (default: 100).
 o preferredWidth()
Gets the subclass' preferred width (default: 100).
 o 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

 o setFont(Font)
Sets the label's font.
 o setLabel(Object)
Sets the value displayed in the label.

HTML param name/value: "Label"/string

 o setLabelImage(URL)
Sets the text for this label to the specified image.
 o setLabelSize(Object)
Set the value's size internally, for use in layout().
 o setLabelSize(Object, Font)
Set the value's size internally, for use in layout().
 o setShadowType(int)
Sets the shadow style.
 o setText(String)
Sets the text for this label to the specified text.
 o setTextList(String[])
Sets the text for this label to the specified String list.

Variables

 o TOPLEFT
 public static final int TOPLEFT
 o LEFT
 public static final int LEFT
 o TOPCENTER
 public static final int TOPCENTER
 o CENTER
 public static final int CENTER
 o TOPRIGHT
 public static final int TOPRIGHT
 o RIGHT
 public static final int RIGHT
 o MIDDLELEFT
 public static final int MIDDLELEFT
 o MIDDLECENTER
 public static final int MIDDLECENTER
 o MIDDLE
 public static final int MIDDLE
 o MIDDLERIGHT
 public static final int MIDDLERIGHT
 o BOTTOMLEFT
 public static final int BOTTOMLEFT
 o BOTTOMCENTER
 public static final int BOTTOMCENTER
 o BOTTOMRIGHT
 public static final int BOTTOMRIGHT
 o SHADOW_NONE
 public static final int SHADOW_NONE
 o SHADOW_ETCHED_IN
 public static final int SHADOW_ETCHED_IN
 o SHADOW_ETCHED_OUT
 public static final int SHADOW_ETCHED_OUT
 o SHADOW_IN
 public static final int SHADOW_IN
 o SHADOW_OUT
 public static final int SHADOW_OUT
 o SHADOW_PLAIN
 public static final int SHADOW_PLAIN
 o SHADOW_FRAME_IN
 public static final int SHADOW_FRAME_IN
 o SHADOW_FRAME_OUT
 public static final int SHADOW_FRAME_OUT
 o label_width
 protected int label_width
 o label_height
 protected int label_height
 o label_rect
 protected Rectangle label_rect
 o url
 protected transient String url
The url that the mouse is currently over.

Constructors

 o JCLabel
 public JCLabel()
Creates an empty label. No parameters are read from an HTML file.

 o JCLabel
 public JCLabel(Object label)
Creates a label with the specified text. No parameters are read from an HTML file.

See Also:
setLabel
 o 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
 o 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
 o 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

Methods

 o 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
 o getAlignment
 public int getAlignment()
Gets the label's alignment.

See Also:
setAlignment
 o 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
 o setFont
 public synchronized void setFont(Font f)
Sets the label's font.

Overrides:
setFont in class JCComponent
 o getLabel
 public Object getLabel()
Gets the label's value.

See Also:
setLabel
 o 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
 o getText
 public String getText()
Gets the text of this label as a String.

See Also:
setText
 o setText
 public void setText(String label)
Sets the text for this label to the specified text.

See Also:
getText
 o getTextList
 public String[] getTextList()
Gets the text of this label as a String list.

See Also:
setTextList
 o 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
 o 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
 o setLabelImage
 public void setLabelImage(URL label)
Sets the text for this label to the specified image.

 o getShadowType
 public int getShadowType()
Gets the shadow style.

See Also:
setShadowType
 o 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
 o drawValue
 protected synchronized void drawValue(Graphics gc,
                                       Object value)
Draws the interior value.

 o paintComponent
 protected void paintComponent(Graphics gc)
Draws value.

Overrides:
paintComponent in class JCComponent
 o setLabelSize
 protected void setLabelSize(Object value)
Set the value's size internally, for use in layout().

See Also:
layout
 o setLabelSize
 protected void setLabelSize(Object value,
                             Font font)
Set the value's size internally, for use in layout().

See Also:
layout
 o addNotify
 public void addNotify()
Creates the peer of the canvas.

Overrides:
addNotify in class JCComponent
 o preferredWidth
 protected int preferredWidth()
Gets the subclass' preferred width (default: 100).

Overrides:
preferredWidth in class JCComponent
 o preferredHeight
 protected int preferredHeight()
Gets the subclass' preferred height (default: 100).

Overrides:
preferredHeight in class JCComponent
 o getLabelBounds
 public Rectangle getLabelBounds()
Gets the bounding rectangle for the label value.

See Also:
setText
 o layout
 public synchronized void layout()
Lays out the component's internal elements.

Overrides:
layout in class JCComponent
 o layout
 protected void layout(Object value)
Lays out the label's internal elements, using the specified value.

 o 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
 o 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