Class Label
All Packages Class Hierarchy This Package Previous Next Index
Class Label *Beta API*
public class netscape.application.Label
extends netscape.application.View
implements netscape.application.Target
{
/* Constructors
*/
public Label();
public Label(String, Font);
/* Methods
*/
public Color color();
public String command();
public int commandKey();
public void decode(Decoder);
public void describeClassInfo(ClassInfo);
public void didSizeBy(int, int);
public void drawView(Graphics);
public void encode(Encoder);
public Font font();
public boolean isTransparent();
public int justification();
public Size minSize();
public void setColor(Color);
public void setCommand(String);
public void setCommandKey(int);
public void setFont(Font);
public void setJustification(int);
public void setTarget(Target);
public void setTitle(String);
public Target target();
public String title();
public Rect underlineRect();
}
A view subclass to implement a label. A label is a small string, used to
indicate the purpose of a control. A label has a command binded with a key.
When the key is pressed, the label send the command to a view. The view is
usualy the view labeled by the label. A label is always transparent.
Constructors
Label
public Label()
- Empty constructor, used for unarchiving.
Label
public Label(String title,
Font aFont)
- Create a new label displaying title. The new label
will have the minimum size to fit title with font.
font can be null. In this case Font.defaultFont()
will be used.
Methods
setJustification
public void setJustification(int aJustification)
- Set the label justification. aJustification can
be Graphics.LEFT_JUSTIFIED, Graphics.CENTERED or
Graphics.RIGHT_JUSTIFIED. The default value is
Graphics.LEFT_JUSTIFIED
justification
public int justification()
- Return the justification for this label
setTitle
public void setTitle(String aTitle)
- Set the label title
title
public String title()
- Return the label title
setFont
public void setFont(Font aFont)
- Set the label font
font
public Font font()
- Return the label font
minSize
public Size minSize()
- Returns the View's minimum size.
the minimum size is always the minimum size
to fit the label
- Overrides:
- minSize in class View
- See Also:
- setMinSize
didSizeBy
public void didSizeBy(int deltaWidth,
int deltaHeight)
- Overriden to invalidate the underline rect
and resize the underline field
- Overrides:
- didSizeBy in class View
setColor
public void setColor(Color aColor)
- Set the label text color
color
public Color color()
- Return the label text color
setTarget
public void setTarget(Target aTarget)
- Set the label target. The target is the object that will receive
a command when the key associated with this label is pressed.
target
public Target target()
- Return the label target.
setCommand
public void setCommand(String aCommand)
- Set the label command. The label command is sent to the target
when the key associated with this label is pressed.
command
public String command()
- Return the label command
setCommandKey
public void setCommandKey(int aKey)
- Set the key that should be pressed for
this label to send its command. The letter matching aKey
will be underlined. Pressing the key when no view has the focus
will send the command. When a view has the focus, pressing ALT + key
will send the command.
commandKey
public int commandKey()
- Returns the key that will fire the command
isTransparent
public boolean isTransparent()
- Overridden to return true
- Overrides:
- isTransparent in class View
underlineRect
public Rect underlineRect()
- This method is called by drawView() to discover the rect of
the black line used to underline the character matching the
key. Use this method if you want to draw the underline in
a different way.
drawView
public void drawView(Graphics g)
- Overriden to underline the letter that matches the key
- Overrides:
- drawView in class View
describeClassInfo
public void describeClassInfo(ClassInfo info)
- Describes the TextField class' information.
- Overrides:
- describeClassInfo in class View
- See Also:
- describeClassInfo
encode
public void encode(Encoder encoder) throws CodingException
- Encodes the TextField instance.
- Overrides:
- encode in class View
- See Also:
- decode
decode
public void decode(Decoder decoder) throws CodingException
- Decodes the TextField instance.
- Overrides:
- decode in class View
- See Also:
- decode
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Apr 1997