Upload
scott-ryan
View
225
Download
0
Tags:
Embed Size (px)
Citation preview
A. What is Radio Button?
Radio buttons allow the user to select one choice from several possible options
The JRadioButton class is used to create radio buttons
JRadioButton constructors:• JRadioButton(String text)• JRadioButton(String text, boolean selected)
Method isSelected() is for checking selection An instance of the ButtonGroup class is used to
group radio buttons
3
B. Metric Converter Example
Reuse the kilometer converter example Convert the distance to feet:
1 kilometer = 3281 feet Convert the distance to inches:
1 kilometer = 39370 inches The new interface is as below:
4
B. Metric Converter Example
1. Enhancing the Design2. Enhancing the KilometerConverterTest Class3. Enhancing the KilometerConverter Class4. Creating the Interface
5
4.1. Creating the Activating Class
Class name: MetricConverterProgram The window’s basic properties:
• Class name: MetricConverter• Title: Metric Converter• Size: 400x100
10
4.2. Creating the Window
4.2.1. Generating the Window4.2.2. Creating the Components4.2.3. Grouping the Radio Buttons4.2.4. Converting to Miles4.2.5. Converting to Feet4.2.6. Converting to Inches
11