2362N/A * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A <code>Label</code> object is a component for placing text in a 0N/A * container. A label displays a single line of read-only text. 0N/A * The text can be changed by the application, but a user cannot edit it 0N/A * For example, the code . . . 0N/A * <hr><blockquote><pre> 0N/A * setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10)); 0N/A * add(new Label("Hi There!")); 0N/A * add(new Label("Another Label")); 0N/A * </pre></blockquote><hr> 0N/A * produces the following labels: 0N/A * ALIGN=center HSPACE=10 VSPACE=7> 0N/A * @author Sami Shaio 0N/A /* ensure that the necessary native libraries are loaded */ 0N/A * Indicates that the label should be left justified. 0N/A * Indicates that the label should be centered. 0N/A * Indicates that the label should be right justified. 0N/A * The text of this label. 0N/A * This text can be modified by the program 0N/A * but never by the user. 0N/A * @see #setText(String) 0N/A * The label's alignment. The default alignment is set 0N/A * to be left justified. 0N/A * @see #getAlignment() 0N/A * @see #setAlignment(int) 0N/A * JDK 1.1 serialVersionUID 0N/A * Constructs an empty label. 0N/A * The text of the label is the empty string <code>""</code>. 0N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs a new label with the specified string of text, 0N/A * @param text the string that the label presents. 0N/A * A <code>null</code> value 0N/A * will be accepted without causing a NullPointerException 0N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Constructs a new label that presents the specified string of 0N/A * text with the specified alignment. 0N/A * Possible values for <code>alignment</code> are <code>Label.LEFT</code>, 0N/A * <code>Label.RIGHT</code>, and <code>Label.CENTER</code>. 0N/A * @param text the string that the label presents. 0N/A * A <code>null</code> value 0N/A * will be accepted without causing a NullPointerException 0N/A * @param alignment the alignment value. 0N/A * @exception HeadlessException if GraphicsEnvironment.isHeadless() 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Read a label from an object input stream. 0N/A * @exception HeadlessException if 0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns 0N/A * @see java.awt.GraphicsEnvironment#isHeadless 0N/A * Construct a name for this component. Called by getName() when the 0N/A * name is <code>null</code>. 0N/A * Creates the peer for this label. The peer allows us to 0N/A * modify the appearance of the label without changing its 0N/A * Gets the current alignment of this label. Possible values are 0N/A * <code>Label.LEFT</code>, <code>Label.RIGHT</code>, and 0N/A * <code>Label.CENTER</code>. 0N/A * @see java.awt.Label#setAlignment 0N/A * Sets the alignment for this label to the specified alignment. 0N/A * Possible values are <code>Label.LEFT</code>, 0N/A * <code>Label.RIGHT</code>, and <code>Label.CENTER</code>. 0N/A * @param alignment the alignment to be set. 0N/A * @exception IllegalArgumentException if an improper value for 0N/A * <code>alignment</code> is given. 0N/A * @see java.awt.Label#getAlignment 0N/A * Gets the text of this label. 0N/A * @return the text of this label, or <code>null</code> if 0N/A * the text has been set to <code>null</code>. 0N/A * @see java.awt.Label#setText 0N/A * Sets the text for this label to the specified text. 0N/A * @param text the text that this label displays. If 0N/A * <code>text</code> is <code>null</code>, it is 0N/A * treated for display purposes like an empty 0N/A * string <code>""</code>. 0N/A * @see java.awt.Label#getText 0N/A synchronized (
this) {
0N/A // This could change the preferred size of the Component. 0N/A * Returns a string representing the state of this <code>Label</code>. 0N/A * This method is intended to be used only for debugging purposes, and the 0N/A * content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not be 0N/A * <code>null</code>. 0N/A * @return the parameter string of this label 0N/A * Initialize JNI field and method IDs 0N/A// Accessibility support 0N/A * Gets the AccessibleContext associated with this Label. 0N/A * For labels, the AccessibleContext takes the form of an 0N/A * AccessibleAWTLabel. 0N/A * A new AccessibleAWTLabel instance is created if necessary. 0N/A * @return an AccessibleAWTLabel that serves as the 0N/A * AccessibleContext of this Label 0N/A * This class implements accessibility support for the 0N/A * <code>Label</code> class. It provides an implementation of the 0N/A * Java Accessibility API appropriate to label user-interface elements. 0N/A * JDK 1.3 serialVersionUID 0N/A * Get the accessible name of this object. 0N/A * @return the localized name of the object -- can be null if this 0N/A * object does not have a name 0N/A * @see AccessibleContext#setAccessibleName 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the object 0N/A * @see AccessibleRole 0N/A }
// inner class AccessibleAWTLabel