初学JAVA 求高手指点怎么运行这个程序啊(感激不尽啊)
public class Temperature {public Temperature(){}
public static double fahrTocels()
{return(5.0*(temp-32.0)/9);
}
public static double celsTofahr()
{return(9.0*temp/5.0+32.0);
}//温度转换
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
pubic class TemperatureUI
{private JTextField inField=new JTextField(15);
private JTextField resultField=new JTextField(15);
private JLabel prompt1=new JLabel("input Temperature>>");
private JLabel prompt2=new JLabel("Conversion Result:");
private JButton fahrToCels=new JButton("F TO C");
private JButton celsToFahr=new JButton("C TO F");
private JPanel panelN=new JPanel();
private JPanel panelC=new JPanel();
private JPanel panelS=new JPanel();
private Temperature temperature=new Temperature();
}//
public class TemperatureJPanel()
{setLayout(new borderLayout);
panelN.setLayout(new borderLayout);
panelC.setLayout(new borderLayout);
panelS.setLayout(new borderLayout);
panelN.add("north",prompt1);
panelN.add("south",inField);
panelC.add("west",fahrToCels);
panelC.add("east",celsToFahr);
panelS.add("north",prompt2);
panelS.add("south",resultField);
add("north",panelN);
add("center",panelC);
add("south",panelS);
celsToFahr.addActionListener(this);
fahrToCels.addActionListener(this);
setSize(170,200);
}
public void actoinPerformed(ActionEvent e)
{String inputStr=inField.getText();
double userInput=double.parsDouble(inputStr);
double result=0;
if(e.sourth==celsToFahr)
{result=temperater.celsToFahr(userIput);
resultField.setText(inputStr"+C="result+"F");
}
if(e.sourth==fahrToCels)
{result=temperature.fahrToCels(userInput);
resultField.setText(inputStr+"F="result+"C");
}//GUI界面
}