I work with java swing . The monitor displays data with the variable newDegree (thanks to Thread, different data is converted every 5 seconds). When the jButton1 button jButton1 pressed, the data should also be constantly changing, but already be displayed in the Fahrenheit format far . While it was possible only to do the following: when the button is pressed, the far value is displayed once. But then again, newDegree . The task is to display far values until quietly until the program is closed or another button is pressed.
In fact, the program simply displays temperature changes in Celsius and must, when the button is pressed, produce constantly Fahrenheit data.
private void heatSensor1HeatChanged(system.HeatChangedEvent evt) { double newDegree = evt.getCelsius(); String date = evt.getDate(); monitor1.setText(String.valueOf(newDegree)); far = newDegree; far = 9*far/5 + 32; System.out.println("F============="); System.out.println(far); System.out.println("F============="); System.out.println("C============="); System.out.println(newDegree); System.out.println("C============="); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { monitor1.setText(String.valueOf(far)); // TODO add your handling code here: }