Sunday, 27 January 2013

JLabel



To create labels, you instantiate objects of the type JLabel. The class JLabel is also contained in the package javax.swing. There are various attributes associated with a label. Every label has a title, width, and a height. The class JLabel contains various methods to control the display of labels.  Some of the constructors for JLabels are:

public JLabel(String str)
public JLabel(String str, int align)
public JLabel(String t, Icon icon, int align)
public JLabel(Icon icon)

Labels are then added to the content pane using the add method.

No comments:

Post a Comment