2. Implement a JFrame that has four Buttons that are labeled as follows: * Red * White. * Blue. * Green Now when the button Red is pressed the main Frame should be colored Red. And so on for the other buttons. Hint: getContentPane().setBackground(); 3. Create a Temperature Convertor JFrame application that has: A JLabel with the text “ Fahrenheit ” A JTextField for the value of temperature in Fahrenheit A JLabel with the text “ Celsius ” A JTextField for the value of temperature in Celsius One JButton labeled “ Convert ” Another JButton labeled “ Clear ” The program will start with empty text fields. The user can enter a value for one of the temperature measurements (assume it is correct all the time) then click calculate. The program should be able to identify the from and to types by checking the text fields, calculate the new value and post it in the corresponding text field. If the user wants to convert new values, he should clear the text fields first by clicking on Clear button. If the user enters a non-numeric value, when he clicks on calculate, the program should clear the text fields and show an appropriate dialog message.
You've reached the end of your free preview.
Want to read both pages?
- Winter '12
- Fahrenheit, Click, David Beckham, Real Madrid C.F., AC Milan