An interesting GUI component in Java is the Slider. Indeed, sliders allow a user to specify a numeric value within a bounded range. Write a program in Java using sliders to simulate the measurement of the temperature in Celsius using a digital thermometer. The following must be achieved: Design the thermometer using an appropriate shape and include the slider inside the shape with tick marks. Use proper layout managers and containers. The thermometer will measure temperatures between -20 oC and 110 oC upon sliding the GUI slider component. The temperature will be displayed in a text field or label. Using another label, a message will be displayed when the temperature reaches a certain value. For example, at -20 oC, the message “It’s ice cold” is displayed, at +10 oC, the message “It’s quite cold” is displayed, at +35 oC, the message “It’s hot” is displayed, etc.
-
An interesting GUI component in Java is the Slider. Indeed, sliders allow a user to specify a numeric value within a bounded range.
Write a program in Java using sliders to simulate the measurement of the temperature in Celsius using a digital thermometer. The following must be achieved:
Design the thermometer using an appropriate shape and include the slider inside the shape with tick marks. Use proper layout managers and containers.
The thermometer will measure temperatures between -20 oC and 110 oC upon sliding the GUI slider component.
The temperature will be displayed in a text field or label.
Using another label, a message will be displayed when the temperature reaches a certain value. For example, at -20 oC, the message “It’s ice cold” is displayed, at +10 oC, the message “It’s quite cold” is displayed, at +35 oC, the message “It’s hot” is displayed, etc.

Step by step
Solved in 4 steps with 3 images









