我正在使用GUI构建一个程序,我正在尝试让程序计算驱动程序是否超过限制。我正在使用动作监听器来读取用户要输入的内容。
public void calculation() {
if(txtSpeed > txtLimit){
System.out.println("The dirver is over the limit");
}
else{
System.out.println("The driver is under the limit");
}
class VhLimitHandler implements ActionListener{
public void actionPerformed(ActionEvent event){
txtLimit = Double.parseDouble(textLimit.getText());
}
}
class VhSpeedHandler implements ActionListener{
public void actionPerformed(ActionEvent event){
txtSpeed = Double.parseDouble(textSpeed.getText());