14.5. The JButton Component
Simple uses of JButton are similar to those for the AWT Button. You create a JButton with a String as a label and then drop the button into a window. Events are normally handled just as with a Button: you attach an ActionListener through the addActionListener method.
New Features: Icons, Alignment, and Mnemonics
The most obvious new feature is the ability to associate images with buttons. Many Swing controls allow the inclusion of icons. Swing introduced a utility class called ImageIcon that lets you easily specify an image file (JPEG or GIF, including animated GIF) for the icon. The simplest way to associate an image with a JButton is to pass the ImageIcon to the constructor, either in place of the text or in addition ...