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)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay