SilverStream
Application Server 3.5

com.sssw.rt.form
Class AgcLabel

java.lang.Object
 |
 +--java.awt.Component
       |
       +--java.awt.Container
             |
             +--javax.swing.JComponent
                   |
                   +--javax.swing.JPanel
                         |
                         +--com.sssw.rt.atlas.AtPanel
                               |
                               +--com.sssw.rt.atlas.AtCanvas
                                     |
                                     +--com.sssw.rt.form.PvBaseCanvas
                                           |
                                           +--com.sssw.rt.form.AgcLabel
All Implemented Interfaces:
Accessible, AgiControl, AgiHelpInfo, ImageObserver, MenuContainer, Serializable

public class AgcLabel
extends PvBaseCanvas

Static text (Label) control for displaying a single line of text within a specified rectangle.

Properties:
Background Color, Border Style, Caption Expression, Caption Text, Control Type, Enabled, Font Name, Font Size, Font Style, Height, Highlight Color, Justification, Left, Name, Shadow Color, Text Color, Text Style, Tool Tip, Top, Transparent, Visible, Width, Word Wrap
Events:
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, validationFailed, validationTest, valueChanged
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
static int BORDER_GROOVED
          Draw a grooved border (default).
static int BORDER_LOWERED
          Draw a lowered border.
static int BORDER_NONE
          No border is displayed.
static int BORDER_OUTLINE
          Draw a one-pixel border.
static int BORDER_RAISED
          Draw a raised border.
static int JUSTIFY_CENTER
          Text is centered.
static int JUSTIFY_LEFT
          Text is left justified (default).
static int JUSTIFY_RIGHT
          Text is right justified.
static int STYLE_DROP_SHADOW
          Display shadow effect (use the text and shadow colors).
static int STYLE_EMBOSSED
          Display with embossed effect (use the text, shadow, and highlight colors).
static int STYLE_NORMAL
          Display regular, flat text, using only the text color (default).
 
Fields inherited from class com.sssw.rt.atlas.AtPanel
BGIMAGE_DRAW_CENTERED, BGIMAGE_DRAW_NORMAL, BGIMAGE_DRAW_STRETCH, BGIMAGE_DRAW_TILED
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
AgcLabel()
           
 
Method Summary
 Color getBackgroundColor()
          Deprecated. replaced by Component.getBackground().
 int getBorderStyle()
          Returns the control's border style.
 Color getForeground()
          Used to obtain the Color of the control's text.
 int getJustification()
          Returns an integer that specifies how the Label's text is aligned on the control.
 String getText()
          Returns a String that contains the control's text.
 Color getTextColor()
          Deprecated. use AgcLabel.getForeground() to obtain the Color of the control's text.
 Color getTextHighlightColor()
          Returns the control's text highlight Color.
 Color getTextShadowColor()
          Returns the control's text shadow Color.
 int getTextStyle()
          Returns an integer that represents the control's text style.
 boolean getWordWrap()
          Returns a boolean value that indicates if the label's text should be wrapped.
 void setBackground(Color color)
          Assigns the control's background Color.
 void setBackgroundColor(Color color)
          Set the background color.
 void setBorderStyle(int style)
          Assigns a style for the control's border.
 void setForeground(Color color)
          Assigns the control's foreground Color.
 void setJustification(int j)
          Specifies how label text is aligned on a control.
 void setText(String label)
          Sets the label text.
 void setTextColor(Color color)
          Deprecated. use AgcLabel.setForeground(Color) to assign an instance of java.awt.Color to the control's text.
 void setTextHighlightColor(Color color)
          Sets the label text highlight color.
 void setTextShadowColor(Color color)
          Sets the text shadow color.
 void setTextStyle(int style)
          Assigns the style for the Label's text.
 void setWordWrap(boolean wrap)
          Takes a boolean value that determines if the Label's text should be wrapped.
 
Methods inherited from class com.sssw.rt.form.PvBaseCanvas
getFontIdentifier, setFontIdentifier
 
Methods inherited from class com.sssw.rt.atlas.AtPanel
addImpl, addNotify, clientPaint, clientPaint, deliverMouseEvent, deliverMouseMoveEvent, doAtCommand, drawTiledImage, enableAtCommands, getBackgroundImage, getBackgroundImageMode, getHelper, getTransparent, hide, hideToolTip, imageUpdate, isFocusTraversable, isOptimizedDrawingEnabled, ownedImage, paintBorder, paintComponent, paintImmediately, paintImmediately, paintNow, preprocessKeyEvent, processEvent, reshape, setBackgroundImage, setBackgroundImageMode, setTransparent, show, showToolTip
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.form.AgiControl
getComponent, getHelpInfo, setHelpInfo
 

Field Detail

JUSTIFY_LEFT

public static final int JUSTIFY_LEFT
Text is left justified (default).
See Also:
AgcLabel.getJustification(), AgcLabel.setJustification(int)

JUSTIFY_CENTER

public static final int JUSTIFY_CENTER
Text is centered.
See Also:
AgcLabel.getJustification(), AgcLabel.setJustification(int)

JUSTIFY_RIGHT

public static final int JUSTIFY_RIGHT
Text is right justified.
See Also:
AgcLabel.getJustification(), AgcLabel.setJustification(int)

STYLE_NORMAL

public static final int STYLE_NORMAL
Display regular, flat text, using only the text color (default).
See Also:
AgcLabel.getTextStyle(), AgcLabel.setTextStyle(int)

STYLE_DROP_SHADOW

public static final int STYLE_DROP_SHADOW
Display shadow effect (use the text and shadow colors).
See Also:
AgcLabel.getTextStyle(), AgcLabel.setTextStyle(int), AgcLabel.getTextShadowColor(), AgcLabel.setTextShadowColor(Color)

STYLE_EMBOSSED

public static final int STYLE_EMBOSSED
Display with embossed effect (use the text, shadow, and highlight colors).
See Also:
AgcLabel.getTextStyle(), AgcLabel.setTextStyle(int), AgcLabel.getTextShadowColor(), AgcLabel.setTextShadowColor(Color), AgcLabel.getTextHighlightColor(), AgcLabel.setTextHighlightColor(Color)

BORDER_NONE

public static final int BORDER_NONE
No border is displayed.
See Also:
AgcLabel.getBorderStyle(), AgcLabel.setBorderStyle(int)

BORDER_OUTLINE

public static final int BORDER_OUTLINE
Draw a one-pixel border.
See Also:
AgcLabel.getBorderStyle(), AgcLabel.setBorderStyle(int)

BORDER_LOWERED

public static final int BORDER_LOWERED
Draw a lowered border.
See Also:
AgcLabel.getBorderStyle(), AgcLabel.setBorderStyle(int)

BORDER_RAISED

public static final int BORDER_RAISED
Draw a raised border.
See Also:
AgcLabel.getBorderStyle(), AgcLabel.setBorderStyle(int)

BORDER_GROOVED

public static final int BORDER_GROOVED
Draw a grooved border (default).
See Also:
AgcLabel.getBorderStyle(), AgcLabel.setBorderStyle(int)
Constructor Detail

AgcLabel

public AgcLabel()
Method Detail

getText

public String getText()
Returns a String that contains the control's text.
Example:

The following code fragment illustrates how to call getText().

   String s;
   s = ControlName1.getText();
 
See Also:
AgcLabel.setText(String)

setText

public void setText(String label)
Sets the label text.
Parameters:
label - specifies the text to assign to the control.
Example:

The following code fragment illustrates how to use the setText() method.

 	ControlName1.setText("Add");
 
See Also:
AgcLabel.getText()

getTextColor

public Color getTextColor()
Deprecated. use AgcLabel.getForeground() to obtain the Color of the control's text.

Example:

The following code fragment illustrates how to use the getTextColor() method.

  Color c;
  c = ControlName1.getTextColor();
 
See Also:
AgcLabel.getForeground(), AgcLabel.setTextColor(Color)

getForeground

public Color getForeground()
Used to obtain the Color of the control's text.
Overrides:
getForeground in class Component
Example:

The following code fragment illustrates how to use the getForeground() method.

  Color c;
  c = ControlName1.getForeground();
 
See Also:
AgcLabel.setForeground(Color)

setTextColor

public void setTextColor(Color color)
Deprecated. use AgcLabel.setForeground(Color) to assign an instance of java.awt.Color to the control's text.

Parameters:
color - specifies the instance of a java.awt.Color Object or one of the Color constants (for example, Color.red).
Example:

The following code fragment illustrates how to set the text Color to red.

 	ControlName1.setTextColor(Color.red);
 
See Also:
AgcLabel.getTextColor()

setForeground

public void setForeground(Color color)
Assigns the control's foreground Color.
Overrides:
setForeground in class JComponent
Parameters:
color - the instance of a java.awt.Color object or one of the Color constants (for example, Color.red).
Usage:

For controls that support it, the Transparent property must be false for the background Color to show.

Example:

The following example illustrates how to set the foreground Color on a control using one of the Color constants:

 	ControlName1.setForeground(Color.white);
 

This example illustrates how to create a new Color and then use it to set the background Color:

  Color colLabelColor = new Color(247, 247, 222);
  ControlName1.setForeground(colLabelColor);
 

getTextShadowColor

public Color getTextShadowColor()
Returns the control's text shadow Color.
Usage:

The control's text shadow Color can be set at runtime using the setTextShadowColor() method. For the Label control, the Shadow Color is only used when the Text Style is Embossed (AgcLabel.STYLE_EMBOSSED) or Drop Shadow (AgcLabel.STYLE_DROP_SHADOW).

Example:

The following code fragment illustrates how to obtain a control's current Text Shadow Color.

  Color c;
  c = ControlName1.getTextShadowColor();
 
See Also:
AgcLabel.setTextShadowColor(Color)

setTextShadowColor

public void setTextShadowColor(Color color)
Sets the text shadow color.
Parameters:
color - specifies the instance of a java.awt.Color object or one of the Color constants (for example, Color.red).
Usage:

For the Label control, the Shadow Color is only used when the Text Style is Embossed (AgcLabel.STYLE_EMBOSSED) or Drop Shadow (AgcLabel.STYLE_DROP_SHADOW).

See Also:
AgcLabel.getTextShadowColor()

getTextHighlightColor

public Color getTextHighlightColor()
Returns the control's text highlight Color.
Usage:

The Highlight Color is only used when the Text Style is Embossed (AgcLabel.STYLE_EMBOSSED).

Example:

The following code fragment illustrates how to obtain a control's text highlight Color.

  Color c;
  c = ControlName1.getTextHighlightColor();
 
See Also:
AgcLabel.setTextHighlightColor(Color)

setTextHighlightColor

public void setTextHighlightColor(Color color)
Sets the label text highlight color.
Parameters:
color - specifies the instance of a java.awt.Color object or one of the Color constants (for example, Color.red).
Usage:

The Highlight Color is only used when the Text Style is Embossed (AgcLabel.STYLE_EMBOSSED).

Example:

The following code fragment illustrates how to set the Highlight Color.

 	ControlName1.setTextHighlightColor(Color.red);
 
See Also:
AgcLabel.getTextHighlightColor()

getTextStyle

public int getTextStyle()
Returns an integer that represents the control's text style.
Usage:

This class defines constant fields for the possible text styles. The text style can be established at design time using the Text Style property, or at runtime using the setTextStyle() method.

Example:

The following code fragment illustrates how to obtain the current text style.

 int style;
 style = ControlName1.getTextStyle();
 
See Also:
AgcLabel.setTextStyle(int)

setTextStyle

public void setTextStyle(int style)
Assigns the style for the Label's text.
Parameters:
style - the text style.
Usage:

This class defines constant fields for the possible text styles.

Example:

The following code fragment illustrates how to use the setTextStyle() method.

 	ControlName1.setTextStyle(AgcLabel.STYLE_EMBOSSED);
 
See Also:
AgcLabel.getTextStyle()

getBackgroundColor

public Color getBackgroundColor()
Deprecated. replaced by Component.getBackground().

Returns the Color object associated with the control's background.
Overrides:
getBackgroundColor in class PvBaseCanvas
Example:

This example illustrates how to obtain the background Color of a control.

  Color bgColor;
  bgColor = ControlName1.getBackgroundColor();
 
See Also:
AgcLabel.setBackgroundColor(Color)

setBackgroundColor

public void setBackgroundColor(Color color)
Deprecated. replaced by AgcLabel.setBackground(Color).

Description copied from class: PvBaseCanvas
Set the background color.
Overrides:
setBackgroundColor in class PvBaseCanvas
Parameters:
color -  
See Also:
AgcLabel.setBackground(Color)

setBackground

public void setBackground(Color color)
Assigns the control's background Color.
Overrides:
setBackground in class JComponent
Parameters:
color - the instance of a java.awt.Color object or one of the Color constants (for example, Color.red).
Usage:

For controls that support it, the Transparent property must be false for the background Color to show.

Example:

The following example illustrates how to set the background Color on a control using one of the Color constants:

  ControlName1.setBackground(Color.white);
 

This example illustrates how to create a new Color and then use it to set the background Color:

  Color colLabelColor = new Color(247, 247, 222);
  ControlName1.setBackground(colLabelColor);
 
See Also:
Component.getBackground()

getJustification

public int getJustification()
Returns an integer that specifies how the Label's text is aligned on the control.
Usage:

This class defines constant fields for the possible justifications.

Example:

The following code fragment illustrates how to call getJustification().

   int j;
   j = ControlName1.getJustification();
 	  if (j == AgcLabel.JUSTIFY_CENTER)
 		System.out.println("The label text is centered.");
 
See Also:
AgcLabel.setJustification(int)

setJustification

public void setJustification(int j)
Specifies how label text is aligned on a control.
Parameters:
j - specifies the text alignment.
Usage:

This class defines constant fields for the possible justifications.

Example:

The following code fragment illustrates how to use the setJustification() method.

 	ControlName1.setJustification(AgcLabel.JUSTIFY_CENTER);
 
See Also:
AgcLabel.getJustification()

getWordWrap

public boolean getWordWrap()
Returns a boolean value that indicates if the label's text should be wrapped.
Usage:

If the value is true, the label's text wraps (that is, the text is displayed on multiple lines if necessary).

Example:

The following code fragment illustrates how to use the getWordWrap() method.

  boolean wordWrap;
  wordWrap = ControlName1.getWordWrap();
 
See Also:
AgcLabel.setWordWrap(boolean)

setWordWrap

public void setWordWrap(boolean wrap)
Takes a boolean value that determines if the Label's text should be wrapped.
Parameters:
wrap - when true, wordwrap is on.
See Also:
AgcLabel.getWordWrap()

getBorderStyle

public int getBorderStyle()
Returns the control's border style.
Usage:

This class defines constant fields for the possible border styles.

Example:

The following code fragment illustrates how to obtain the border style.

  int borderStyle;
  borderStyle = ControlName1.getBorderStyle();
 
See Also:
AgcLabel.setBorderStyle(int)

setBorderStyle

public void setBorderStyle(int style)
Assigns a style for the control's border.
Parameters:
style - specifies the border style.
Usage:

This class defines constant fields for the possible border styles. These constants must be qualified using the classname, for example, AgcLabel.BORDER_OUTLINE.

Example:

The following code fragment illustrates how to set a label's border style to outline style.

 	ControlName1.setBorderStyle(AgcLabel.BORDER_OUTLINE);
 
See Also:
AgcLabel.getBorderStyle()

SilverStream
Application Server 3.5