📄 jlabel.html
字号:
<DD>Creates a <code>JLabel</code> instance with the specified text. The label is aligned against the leading edge of its display area, and centered vertically.<DD><DL><DT><B>Parameters:</B><DD><CODE>text</CODE> - The text to be displayed by the label.</DL></DD></DL><HR><A NAME="JLabel(javax.swing.Icon, int)"><!-- --></A><H3>JLabel</H3><PRE>public <B>JLabel</B>(<A HREF="../../javax/swing/Icon.html">Icon</A> image, int horizontalAlignment)</PRE><DL><DD>Creates a <code>JLabel</code> instance with the specified image and horizontal alignment. The label is centered vertically in its display area.<DD><DL><DT><B>Parameters:</B><DD><CODE>icon</CODE> - The image to be displayed by the label.<DD><CODE>horizontalAlignment</CODE> - One of the following constants defined in <code>SwingConstants</code>: <code>LEFT</code>, <code>CENTER</code>, <code>RIGHT</code>, <code>LEADING</code> or <code>TRAILING</code>.</DL></DD></DL><HR><A NAME="JLabel(javax.swing.Icon)"><!-- --></A><H3>JLabel</H3><PRE>public <B>JLabel</B>(<A HREF="../../javax/swing/Icon.html">Icon</A> image)</PRE><DL><DD>Creates a <code>JLabel</code> instance with the specified image. The label is centered vertically and horizontally in its display area.<DD><DL><DT><B>Parameters:</B><DD><CODE>icon</CODE> - The image to be displayed by the label.</DL></DD></DL><HR><A NAME="JLabel()"><!-- --></A><H3>JLabel</H3><PRE>public <B>JLabel</B>()</PRE><DL><DD>Creates a <code>JLabel</code> instance with no image and with an empty string for the title. The label is centered vertically in its display area. The label's contents, once set, will be displayed on the leading edge of the label's display area.</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getUI()"><!-- --></A><H3>getUI</H3><PRE>public <A HREF="../../javax/swing/plaf/LabelUI.html">LabelUI</A> <B>getUI</B>()</PRE><DL><DD>Returns the L&F object that renders this component.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>LabelUI object</DL></DD></DL><HR><A NAME="setUI(javax.swing.plaf.LabelUI)"><!-- --></A><H3>setUI</H3><PRE>public void <B>setUI</B>(<A HREF="../../javax/swing/plaf/LabelUI.html">LabelUI</A> ui)</PRE><DL><DD>Sets the L&F object that renders this component.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>ui</CODE> - the LabelUI L&F object<DT><B>See Also: </B><DD><A HREF="../../javax/swing/UIDefaults.html#getUI(javax.swing.JComponent)"><CODE>UIDefaults.getUI(javax.swing.JComponent)</CODE></A></DL></DD></DL><HR><A NAME="updateUI()"><!-- --></A><H3>updateUI</H3><PRE>public void <B>updateUI</B>()</PRE><DL><DD>Notification from the UIFactory that the L&F has changed.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../javax/swing/JComponent.html#updateUI()">updateUI</A></CODE> in class <CODE><A HREF="../../javax/swing/JComponent.html">JComponent</A></CODE></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../javax/swing/JComponent.html#updateUI()"><CODE>JComponent.updateUI()</CODE></A></DL></DD></DL><HR><A NAME="getUIClassID()"><!-- --></A><H3>getUIClassID</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getUIClassID</B>()</PRE><DL><DD>Returns a string that specifies the name of the l&f class that renders this component.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../javax/swing/JComponent.html#getUIClassID()">getUIClassID</A></CODE> in class <CODE><A HREF="../../javax/swing/JComponent.html">JComponent</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>String "LabelUI"<DT><B>See Also: </B><DD><A HREF="../../javax/swing/JComponent.html#getUIClassID()"><CODE>JComponent.getUIClassID()</CODE></A>, <A HREF="../../javax/swing/UIDefaults.html#getUI(javax.swing.JComponent)"><CODE>UIDefaults.getUI(javax.swing.JComponent)</CODE></A></DL></DD></DL><HR><A NAME="getText()"><!-- --></A><H3>getText</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>getText</B>()</PRE><DL><DD>Returns the text string that the label displays.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a String<DT><B>See Also: </B><DD><A HREF="../../javax/swing/JLabel.html#setText(java.lang.String)"><CODE>setText(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setText(java.lang.String)"><!-- --></A><H3>setText</H3><PRE>public void <B>setText</B>(<A HREF="../../java/lang/String.html">String</A> text)</PRE><DL><DD>Defines the single line of text this component will display. If the value of text is null or empty string, nothing is displayed. <p> The default value of this property is null. <p> This is a JavaBeans bound property.<DD><DL></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../javax/swing/JLabel.html#setVerticalTextPosition(int)"><CODE>setVerticalTextPosition(int)</CODE></A>, <A HREF="../../javax/swing/JLabel.html#setHorizontalTextPosition(int)"><CODE>setHorizontalTextPosition(int)</CODE></A>, <A HREF="../../javax/swing/JLabel.html#setIcon(javax.swing.Icon)"><CODE>setIcon(javax.swing.Icon)</CODE></A></DL></DD></DL><HR><A NAME="getIcon()"><!-- --></A><H3>getIcon</H3><PRE>public <A HREF="../../javax/swing/Icon.html">Icon</A> <B>getIcon</B>()</PRE><DL><DD>Returns the graphic image (glyph, icon) that the label displays.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>an Icon<DT><B>See Also: </B><DD><A HREF="../../javax/swing/JLabel.html#setIcon(javax.swing.Icon)"><CODE>s
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -