Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void temperatureHandler() {
- if (cBox.getValue() == "Celsius (C)") {
- celsiusOutput.setText(Double.toString(dValue));
- fahrenheitOutput.setText(Double.toString((dValue * 1.8) + 32));
- kelvinOutput.setText(Double.toString(dValue + 273.15));
- }
- else if (cBox.getValue() == "Fahrenheit (F)") {
- celsiusOutput.setText(Double.toString((dValue - 32) / 1.8));
- fahrenheitOutput.setText(Double.toString(dValue));
- kelvinOutput.setText(Double.toString((dValue + 459.67) * 5/9));
- }
- else if (cBox.getValue() == "Kelvin (K)") {
- celsiusOutput.setText(Double.toString(dValue - 273.15));
- fahrenheitOutput.setText(Double.toString((dValue * 1.8) - 459.67));
- kelvinOutput.setText(Double.toString(dValue));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment