{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

FahrenheitGUI - FahrenheitGUI.java Author Lewis/Loftus...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // FahrenheitGUI.java Author: Lewis/Loftus // // Solution to Programming Project 5.10 //******************************************************************** / import java.awt.Graphics; import java.awt.Color; import java.awt.Dimension; import java.awt.event.*; import javax.swing.*; i public class FahrenheitGUI { private int WIDTH = 300; private int HEIGHT = 75; private JFrame frame; private JPanel panel; private JLabel inputLabel, outputLabel, resultLabel; private JTextField fahrenheit; private JButton convertButton; //----------------------------------------------------------------- // Sets up the GUI. //----------------------------------------------------------------- public FahrenheitGUI() { frame = new JFrame ("Temperature Conversion"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); inputLabel = new JLabel ("Enter Fahrenheit temperature:"); outputLabel = new JLabel ("Temperature in Celsius: "); resultLabel = new JLabel ("---"); fahrenheit = new JTextField (5); fahrenheit.addActionListener (new TempListener()); convertButton = new JButton("Convert"); convertButton.addActionListener (new TempListener()); panel = new JPanel(); panel.setPreferredSize (new Dimension(WIDTH, HEIGHT));
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}