DEV Community

Comficker
Comficker

Posted on

JAVA SWING Cheat Sheet: JLabel Class

Following is the declaration for javax.swing.JLabel class −
Following are the fields for javax.swing.JLabel class

protected Component labelFor

  • JLabel() - Creates a JLabel instance with no image and with an empty string for the title.
  • JLabel(Icon image) - Creates a JLabel instance with the specified image.
  • 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(String text, Icon icon, int horizontalAlignment) - Creates a JLabel instance with the specified text, image, and horizontal alignment.
  • JLabel(String text, int horizontalAlignment) - Creates a JLabel instance with the specified text and horizontal alignment.

Swing Cheat Sheet

Top comments (0)