Let's get started with a Temperature Conversion application!
Open Eclipse
Right-Click on your edu.buffalostate.cis425.fa10.exercises..your-username package
Choose: File -> new -> other
Choose: WindowBuilder -> Swing Designer -> JFrame
In the Name: textbox type: TempConvert
Click: Finish
Add this line after all the import lines: import java.text.DecimalFormat;
Click the Design tab
In the Frame -> Properties window, change the Title to: Temperature Conversion App
In the Properties window, change the Layout drop-down to: GridBagLayout
Click on the JPanel icon
Move your cursor into the Frame and click to place the panel inside the frame
In the Properties window, change the Layout drop-down to: GridBagLayout
Click on the JLabel icon
Move your cursor into the Frame and click to place the label inside the panel
Change the new Label to: Temperature:
Click on the JTextField icon
Move your cursor into the Frame and click to place the textbox next to the Temperature: label
In the Properties window, change the Variable to: tempStr
Click on the JButton icon
Move your cursor into the Frame and click the mouse button to place the button next to the Temperature: label and textbox
In the Properties window, change the variable to: clickBtn
In the Properties window, change the text to: Click to Convert!
Click on the JTextField icon
Move your cursor into the Frame and click to place the textbox below the button
In the Properties window, change the variable to: fOut
In the Properties window, change the Columns to: 5
Click on the JTextField icon
In the Properties window, change the text to: Farenheit converts to
Click on the JTextField icon
In the Properties window, change the Columns to: 5
In the Properties window, change the variable to: cOut
Right-click on the button
Choose: Add Event Handler -> Action -> Action Performed
When the Source window opens, after this line: public void actionPerformed(ActionEvent e) {
add these lines:
DecimalFormat myFormat = new DecimalFormat("###.0");