I have a small program to do and i am stuck with floating point. I want the result to be in 1 dicimle only.
this is my program
I want to make a floating point in both results whether i convert from F to C or C to F.
i am using JFrame, and i tried to use String.format
but i doesn't work!
private void cTFActionPerformed(java.awt.event.ActionEvent evt) {
float tempFahr = (float) ((Float.parseFloat(cTF.getText()))
* 1.8 + 32);
fTF.setText(tempFahr + "");
String.format("%.1", tTF.getText());
The program is working fine, but i had a problem with the dicimles only.
Can you explain to me how to use it with JFrame ?
Edit:
we found the solution already