GUI Applications ButtonGroup and JRadioButton
Contents A.Problem: The Metric Converter Application B.Solution C.Exercise: Moving all calculations into a separate class
A. Problem: The Metric Converter App Develop a GUI that allows the user to enter a distance in kilometers, and then click on radio buttons to see that distance converted to miles, feet, or inches The conversion formulas are Miles = Kilometers Feet = Kilometers Inches = Kilometers
B. Solution 1.Developing the View 2.Developing test cases 3.Implementing event handlers for the radio buttons
1. Developing the View Project name: Metric Converter Class name: MetricConverterView Package: metricconverter Frame title: Metric Converter GUI components –The Km panel 1 Label 1 Text field –The button panel 1 Button group 3 radio buttons
2. Developing test cases 2 kilometers = miles = feet = inches
3. Implementing event handlers for the radio buttons
C. Exercise: Moving all calculations into a separate class
The View & Controller
The Model
References 1.GUI Building in NetBeans IDE tart-gui.html tart-gui.html 2.Starting Out With Java 5 from control structures to objects. Tony Gaddis