java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
public class JLabel extends JComponent
Constructor Summary |
---|
JLabel()
Creates a JLabel instance with
no image and with an empty string for the title. |
JLabel(String text)
Creates a JLabel instance with the specified text. |
JLabel(String text,
int horizontalAlignment)
Creates a JLabel instance with the specified
text and horizontal alignment. |
Method Summary | |
---|---|
int |
getHorizontalAlignment()
Returns the alignment of the label's contents along the X axis. |
int |
getHorizontalTextPosition()
Returns the horizontal position of the label's text, relative to its image. |
String |
getText()
Returns the text string that the label displays. |
int |
getVerticalAlignment()
Returns the alignment of the label's contents along the Y axis. |
int |
getVerticalTextPosition()
Returns the vertical position of the label's text, relative to its image. |
void |
setHorizontalAlignment(int alignment)
Sets the alignment of the label's contents along the X axis. |
void |
setHorizontalTextPosition(int textPosition)
Sets the horizontal position of the label's text, relative to its image. |
void |
setText(String text)
Defines the single line of text this component will display. |
void |
setVerticalAlignment(int alignment)
Sets the alignment of the label's contents along the Y axis. |
void |
setVerticalTextPosition(int textPosition)
Sets the vertical position of the label's text, relative to its image. |