java - Get input from button -


i have program receives input command line before. want make gui using java swing. supposed have program flow such below:

while(!end){     in = getinputfromuser();     /*value can 1,2, or 3*/      execute(in);      /* else */      end = isendcondition(); } 

how can input using 3 buttons instead?

depending on how gui should work, typically use actionlistener definied on button. here complete example (including text field) oracle documentation: https://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -