The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing  [141 examples] > JRadioButton  [6 examples]

e772. Adding an Icon to the Label of a JRadioButton Component

Unlike a JButton, setIcon() does not add an icon to the text label. Rather, in a radio button, the method is used to customize the icons used to depict its state. However, by using the HTML capabilities in a label, it is possible to add an icon to the label without affecting the state-depicting icons. This technique is identical to the one used for checkboxes. For more information, see e754 Adding an Icon to the Label of a JCheckBox Component.

 Related Examples
e768. Creating a JRadioButton Component
e769. Selecting a JRadioButton Component in a Button Group
e770. Determining the Selected JRadioButton in a Button Group
e771. Determining If a JRadioButton Component Is Selected
e773. Customizing the Icons in a JRadioButton Component

See also: Actions    JButton    JCheckBox    JComboBox    JDesktop and JInternalFrame    JFrame, JWindow, JDialog    JLabel    JList    JProgressBar    JScrollPane    JSlider    JSpinner    JSplitPane    JTabbedPane    JToolBar    Keystrokes and Input Maps    Layout    Look and Feel    Menus    Progress Monitor    The Screen    Tool Tips    UI Default Values   


© 2002 Addison-Wesley.