I l@ve RuBoard |
![]() ![]() |
5.8 The JRadioButton ClassJRadioButton is a subclass of JToggleButton, typically used with other JRadioButtons, that allows users to make a single selection from a set of options (Figure 5-8). Because radio buttons form a set of choices, JRadioButtons are usually used in groups, managed by a ButtonGroup (described in the next section). If you specify an icon for the radio button, you should also specify a selected icon so it will be visually apparent if a button is selected. Figure 5-8. JRadioButtons in four L&Fs![]() 5.8.1 PropertiesThe JRadioButton class inherits all its properties and most of its default values from its superclass. The only exceptions are shown in Table 5-14. By default, no border is painted on JRadioButtons, and their horizontalAlignment is set to the leading edge (to the left in the default locale, in which text reads left to right).[7]
5.8.1.1 EventsSee the discussion of JToggleButton (JRadioButton's superclass) events. 5.8.2 Constructors
5.8.3 Opaque JRadioButtons and JCheckBoxesTypically, JRadioButtons and JCheckBoxes should be left transparent (not opaque) with their contentAreaFilled property set to false. These components usually fill only some of their allocated space, and making them opaque or filled causes an awkward-looking rectangle to be painted behind them, as shown in Figure 5-9. Figure 5-9. Opaque JCheckBox and JRadioButton![]() |
I l@ve RuBoard |
![]() ![]() |