Example usage for Java javax.swing JLabel fields, constructors, methods, implement or subclass
The text is from its open source code.
JLabel(String text, int horizontalAlignment) Creates a JLabel instance with the specified text and horizontal alignment. | |
JLabel(Icon image, int horizontalAlignment) Creates a JLabel instance with the specified image and horizontal alignment. | |
JLabel(String text) Creates a JLabel instance with the specified text. | |
JLabel(Icon image) Creates a JLabel instance with the specified image. | |
JLabel(String text, Icon icon, int horizontalAlignment) Creates a JLabel instance with the specified text, image, and horizontal alignment. | |
JLabel() Creates a JLabel instance with no image and with an empty string for the title. |
Component | add(Component comp) Appends the specified component to the end of this container. |
Component | add(String name, Component comp) Adds the specified component to this container. |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. |
AccessibleContext | getAccessibleContext() Get the AccessibleContext of this object |
Color | getBackground() Gets the background color of this component. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
Rectangle | getBounds() Gets the bounds of this component in the form of a Rectangle object. |
Icon | getDisabledIcon() Returns the icon used by the label when it's disabled. |
int | getDisplayedMnemonic() Return the keycode that indicates a mnemonic key. |
int | getDisplayedMnemonicIndex() Returns the character, as an index, that the look and feel should provide decoration for as representing the mnemonic character. |
Font | getFont() Gets the font of this component. |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
Color | getForeground() Gets the foreground color of this component. |
Graphics | getGraphics() Returns this component's graphics context, which lets you draw on a component. |
int | getHeight() Returns the current height of this component. |
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. |
Icon | getIcon() Returns the graphic image (glyph, icon) that the label displays. |
int | getIconTextGap() Returns the amount of space between the text and the icon displayed in this label. |
Insets | getInsets(Insets insets) Returns an Insets object containing this component's inset values. |
Component | getLabelFor() Get the component this is labelling. |
Point | getLocation() Gets the location of this component in the form of a point specifying the component's top-left corner. |
Point | getLocationOnScreen() Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space. |
Dimension | getMinimumSize() If the minimum size has been set to a non- null value just returns it. |
String | getName() Gets the name of the component. |
Container | getParent() Gets the parent of this component. |
Dimension | getPreferredSize() If the preferredSize has been set to a non-null value just returns it. |
Dimension | getSize() Returns the size of this component in the form of a Dimension object. |
String | getText() Returns the text string that the label displays. |
String | getToolTipText() Returns the tooltip string that has been set with setToolTipText . |
TransferHandler | getTransferHandler() Gets the transferHandler property. |
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. |
int | getWidth() Returns the current width of this component. |
int | getX() Returns the current x coordinate of the component's origin. |
int | getY() Returns the current y coordinate of the component's origin. |
boolean | isEnabled() Determines whether this component is enabled. |
boolean | isOpaque() Returns true if this component is completely opaque. |
boolean | isVisible() Determines whether this component should be visible when its parent is visible. |
void | paint(Graphics g) Invoked by Swing to draw components. |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | removeMouseListener(MouseListener l) Removes the specified mouse listener so that it no longer receives mouse events from this component. |
void | repaint() Repaints this component. |
void | revalidate() Supports deferred automatic layout. |
void | setAlignmentX(float alignmentX) Sets the horizontal alignment. |
void | setAlignmentY(float alignmentY) Sets the vertical alignment. |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setBounds(Rectangle r) Moves and resizes this component to conform to the new bounding rectangle r . |
void | setComponentOrientation(ComponentOrientation o) Sets the language-sensitive orientation that is to be used to order the elements or text within this component. |
void | setComponentPopupMenu(JPopupMenu popup) Sets the JPopupMenu for this JComponent . |
void | setCursor(Cursor cursor) Sets the cursor image to the specified cursor. |
void | setDisabledIcon(Icon disabledIcon) Set the icon to be displayed if this JLabel is "disabled" (JLabel.setEnabled(false)). |
void | setDisplayedMnemonic(int key) Specify a keycode that indicates a mnemonic key. |
void | setDisplayedMnemonic(char aChar) Specifies the displayedMnemonic as a char value. |
void | setDisplayedMnemonicIndex(int index) Provides a hint to the look and feel as to which character in the text should be decorated to represent the mnemonic. |
void | setEnabled(boolean enabled) Sets whether or not this component is enabled. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFocusCycleRoot(boolean focusCycleRoot) Sets whether this Container is the root of a focus traversal cycle. |
void | setFont(Font font) Sets the font for this component. |
void | setForeground(Color fg) Sets the foreground color of this component. |
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 | setIcon(Icon icon) Defines the icon this component will display. |
void | setIconTextGap(int iconTextGap) If both the icon and text properties are set, this property defines the space between them. |
void | setLabelFor(Component c) Set the component this is labelling. |
void | setLayout(LayoutManager mgr) Sets the layout manager for this container. |
void | setLocation(int x, int y) Moves this component to a new location. |
void | setLocation(Point p) Moves this component to a new location. |
void | setMaximumSize(Dimension maximumSize) Sets the maximum size of this component to a constant value. |
void | setMinimumSize(Dimension minimumSize) Sets the minimum size of this component to a constant value. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setSize(Dimension d) Resizes this component so that it has width d.width and height d.height . |
void | setText(String text) Defines the single line of text this component will display. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(TransferHandler newHandler) Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop. |
void | setUI(LabelUI ui) Sets the L&F object that renders this component. |
void | setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget) Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. |
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. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
void | validate() Validates this container and all of its subcomponents. |