java - How can I finish this calc in JavaFX? -


how can use event handler buttons if statements (no fxml), have , not working, i'm trying 1+1=2 work ...

eventhandler handle = new eventhandler() {             @override             public void handle(event event)             {                 button tempbutton = ((button) event.getsource());//get button being pressed                     string currentbuttonpress = tempbutton.gettext();//get text of button being pressed                  //depending on button text action                 switch (currentbuttonpress) {                     case "+":                         tempstring = result.gettext();                         system.out.println(tempstring);                         tempint = integer.parseint(tempstring);                         result.clear();                                                  break;                                            default:                         result.appendtext(currentbuttonpress);                 }            }         }; 


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -