14.4. The JLabel Component
In many cases, JLabel is used exactly like Label: as a way to display text. However, a JLabel has three major features that a Label does not. A JLabel can display an image instead of or in addition to the text, can have borders, and can use HTML content to format the label. These three major features are discussed next.
New Features: Images, Borders, and HTML Content
The first new feature of a JLabel is image display, which you use usually by supplying an ImageIcon either to the constructor or through a call to setIcon. The use of icons in JLabel is just like the use in JButton; see Section 14.5 (The JButton Component) for additional details and code examples. For an example, however, see the third JLabel in Listing ...