A label is a display area for a short text, an image, or both. It is often used to label other components (usually text fields). Figure 15.15 lists the constructors and methods in JLabel .
JLabel inherits all the properties from JComponent and has many properties similar to the ones in JButton , such as text , icon , horizontalAlignment , verticalAlignment , horizontalTextPosition , verticalTextPosition , and iconTextGap . For example, the following code displays a label with text and an icon: