src/share/classes/java/awt/Label.java

Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:


  32 /**
  33  * A <code>Label</code> object is a component for placing text in a
  34  * container. A label displays a single line of read-only text.
  35  * The text can be changed by the application, but a user cannot edit it
  36  * directly.
  37  * <p>
  38  * For example, the code&nbsp;.&nbsp;.&nbsp;.
  39  *
  40  * <hr><blockquote><pre>
  41  * setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
  42  * add(new Label("Hi There!"));
  43  * add(new Label("Another Label"));
  44  * </pre></blockquote><hr>
  45  * <p>
  46  * produces the following labels:
  47  * <p>
  48  * <img src="doc-files/Label-1.gif" alt="Two labels: 'Hi There!' and 'Another label'"
  49  * style="float:center; margin: 7px 10px;">
  50  *
  51  * @author      Sami Shaio
  52  * @since       JDK1.0
  53  */
  54 public class Label extends Component implements Accessible {
  55 
  56     static {
  57         /* ensure that the necessary native libraries are loaded */
  58         Toolkit.loadLibraries();
  59         if (!GraphicsEnvironment.isHeadless()) {
  60             initIDs();
  61         }
  62     }
  63 
  64     /**
  65      * Indicates that the label should be left justified.
  66      */
  67     public static final int LEFT        = 0;
  68 
  69     /**
  70      * Indicates that the label should be centered.
  71      */
  72     public static final int CENTER      = 1;
  73 
  74     /**
  75      * Indicates that the label should be right justified.
  76      * @since   JDK1.0t.
  77      */
  78     public static final int RIGHT       = 2;
  79 
  80     /**
  81      * The text of this label.
  82      * This text can be modified by the program
  83      * but never by the user.
  84      *
  85      * @serial
  86      * @see #getText()
  87      * @see #setText(String)
  88      */
  89     String text;
  90 
  91     /**
  92      * The label's alignment.  The default alignment is set
  93      * to be left justified.
  94      *
  95      * @serial
  96      * @see #getAlignment()




  32 /**
  33  * A <code>Label</code> object is a component for placing text in a
  34  * container. A label displays a single line of read-only text.
  35  * The text can be changed by the application, but a user cannot edit it
  36  * directly.
  37  * <p>
  38  * For example, the code&nbsp;.&nbsp;.&nbsp;.
  39  *
  40  * <hr><blockquote><pre>
  41  * setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
  42  * add(new Label("Hi There!"));
  43  * add(new Label("Another Label"));
  44  * </pre></blockquote><hr>
  45  * <p>
  46  * produces the following labels:
  47  * <p>
  48  * <img src="doc-files/Label-1.gif" alt="Two labels: 'Hi There!' and 'Another label'"
  49  * style="float:center; margin: 7px 10px;">
  50  *
  51  * @author      Sami Shaio
  52  * @since       1.0
  53  */
  54 public class Label extends Component implements Accessible {
  55 
  56     static {
  57         /* ensure that the necessary native libraries are loaded */
  58         Toolkit.loadLibraries();
  59         if (!GraphicsEnvironment.isHeadless()) {
  60             initIDs();
  61         }
  62     }
  63 
  64     /**
  65      * Indicates that the label should be left justified.
  66      */
  67     public static final int LEFT        = 0;
  68 
  69     /**
  70      * Indicates that the label should be centered.
  71      */
  72     public static final int CENTER      = 1;
  73 
  74     /**
  75      * Indicates that the label should be right justified.

  76      */
  77     public static final int RIGHT       = 2;
  78 
  79     /**
  80      * The text of this label.
  81      * This text can be modified by the program
  82      * but never by the user.
  83      *
  84      * @serial
  85      * @see #getText()
  86      * @see #setText(String)
  87      */
  88     String text;
  89 
  90     /**
  91      * The label's alignment.  The default alignment is set
  92      * to be left justified.
  93      *
  94      * @serial
  95      * @see #getAlignment()