Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class Label  view Label download Label.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Label
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, MenuContainer, java.io.Serializable

public class Label
extends Component
implements javax.accessibility.Accessible

This component is used for displaying simple text strings that cannot be edited by the user.


Nested Class Summary
protected  class Label.AccessibleAWTLabel
          This class provides accessibility support for the label.
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener
 
Field Summary
private  int alignment
           
static int CENTER
          Alignment constant aligning the text in the center of its window.
static int LEFT
          Alignment constant aligning the text to the left of its window.
static int RIGHT
          Alignment constant aligning the text to the right of its window.
private static long serialVersionUID
           
private  java.lang.String text
           
 
Fields inherited from class java.awt.Component
accessibleContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, changeSupport, componentListener, componentSerializedDataVersion, cursor, dropTarget, enabled, eventMask, focusable, focusListener, focusTraversalKeys, focusTraversalKeysEnabled, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyListener, ignoreRepaint, inputMethodListener, isFocusTraversableOverridden, isPacked, keyListener, LEFT_ALIGNMENT, locale, minSize, mouseListener, mouseMotionListener, mouseWheelListener, name, nameExplicitlySet, newEventsOnly, orientation, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, TOP_ALIGNMENT, treeLock, valid, visible, width, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Label()
          Initializes a new instance of Label with no text.
Label(java.lang.String text)
          Initializes a new instance of Label with the specified text that is aligned to the left.
Label(java.lang.String text, int alignment)
          Initializes a new instance of Label with the specified text and alignment.
 
Method Summary
 void addNotify()
          Notifies this label that it has been added to a container, causing the peer to be created.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this Label.
 int getAlignment()
          Returns the constant indicating the alignment of the text in this label.
 java.lang.String getText()
          Returns the text displayed in this label.
protected  java.lang.String paramString()
          Returns a parameter string useful for debugging.
 void setAlignment(int alignment)
          Sets the text alignment of this label to the specified value.
 void setText(java.lang.String text)
          Sets the text in this label to the specified value.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, findNextFocusComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, generateName, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getGraphicsConfigurationImpl, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
Alignment constant aligning the text to the left of its window.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Alignment constant aligning the text in the center of its window.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Alignment constant aligning the text to the right of its window.

See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

alignment

private int alignment

text

private java.lang.String text
Constructor Detail

Label

public Label()
Initializes a new instance of Label with no text.


Label

public Label(java.lang.String text)
Initializes a new instance of Label with the specified text that is aligned to the left.


Label

public Label(java.lang.String text,
             int alignment)
Initializes a new instance of Label with the specified text and alignment.

Method Detail

getAlignment

public int getAlignment()
Returns the constant indicating the alignment of the text in this label. The value returned will be one of the alignment constants from this class.


setAlignment

public void setAlignment(int alignment)
Sets the text alignment of this label to the specified value.


getText

public java.lang.String getText()
Returns the text displayed in this label.


setText

public void setText(java.lang.String text)
Sets the text in this label to the specified value.


addNotify

public void addNotify()
Notifies this label that it has been added to a container, causing the peer to be created. This method is called internally by the AWT system.

Overrides:
addNotify in class Component

paramString

protected java.lang.String paramString()
Returns a parameter string useful for debugging.

Overrides:
paramString in class Component

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Label. The context is created, if necessary.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class Component