I am building a program with a GUI and i am trying to get the program to calculate if a driver is over or under the limit. I am using an action listener in order to read what the user is going to type in.
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());
Aucun commentaire:
Enregistrer un commentaire