Witam serdecznie.
Staram sie napisać programik który po wpisaniu liczby odpowiadającej temperaturze w stopniach Celsiusza zmieni je w stopnie Fahrenheita lub vice versa.
Są dwa JTextField, w jednym uzytkownik wpisuje liczbe a w drugim po nacisnieciu przycisku wyskakuje temperatura w Fahrenheitach.
Prosiłbym chociaż o podpowiedz czego mam szukać
Z góry dziękuję za pomoc
juz mam tyle co mi daje mozliwosc przenoszenia tekstu z jednego JTextField do rugiego ale nadal nie wiem jak to zrobić, żeby program konwertował wpisane liczby na fahrenheity
import java.awt.;
import java.awt.event.;
import javax.swing.*;
public class JFrame2 extends JFrame
{
Container con;
String myText;
JLabel colourLabel;
JButton colourButton;
JLabel textLabel;
JTextField normalText;
JTextField changeText;
JButton getTextButton;
JButton setTextButton;
public JFrame2()
{
super("This is second JFrame");
con = getContentPane();
textLabel = new JLabel("Please enter text");
normalText = new JTextField(20);
changeText = new JTextField(20);
getTextButton = new JButton("get text");
setTextButton = new JButton("change text");
FlowLayout myLayout = new FlowLayout();
con.setLayout(myLayout);
con.add(textLabel);
con.add(normalText);
con.add(changeText);
con.add(getTextButton);
con.add(setTextButton);
getTextButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
myText = normalText.getText();
}
});
setTextButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
changeText.setText(myText.toUpperCase());
}
});
pack();
setLocation(210,150);
setSize(400, 300);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String [] args)
{
JFrame2 myLogin = new JFrame2();
}
}