0% found this document useful (0 votes)
61 views

14 Demo Binary Search

This document describes building a GUI temperature converter with one text box to enter a temperature, two labels to display the converted temperatures, and a button to trigger the conversion. The code sample shows how to take the input temperature, convert it to Fahrenheit by multiplying by 1.8 and adding 32, and display the result in one of the labels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

14 Demo Binary Search

This document describes building a GUI temperature converter with one text box to enter a temperature, two labels to display the converted temperatures, and a button to trigger the conversion. The code sample shows how to take the input temperature, convert it to Fahrenheit by multiplying by 1.8 and adding 32, and display the result in one of the labels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Temperature Conversion in GUI

Objectives

 To be able to design the temperature convertor

Create One text box, Two labels and one Button on Jform.

Use the following code for this exercise.

int tempFahr = (int)((Double.parseDouble(Temptextfield.getText())) * 1.8 +32);

Fahrenheitlabel.setText(tempFahr + " Fahrenheit" );

You might also like