capturing events from an inputDialog in java

0

I have an inputDialog but I would like to know if you could add events to that dialog since I do not want to enter letters and that when I press a letter I just do not write it I only have this

JOptionPane.showInputDialog(null, "Ingrese la cantidad a llevar: "); 
    
asked by Obeth Morales 22.09.2018 в 05:25
source

2 answers

0

Can you explain yourself better?

  

'by pressing a letter simply do not write it down'

For Java there is a library called JavaFX that through programs like Scene Builder, allows you to graphically associate a method with events like 'onclick', etc. You could use this to get input dialog into a method associated with an event.

    
answered by 22.09.2018 в 09:30
0

You can use a KeyEvent, a keyboard event, add a condition, where you call the KeyEvent and compare it with the data type of the variable where you have to save the data.

    
answered by 23.09.2018 в 08:53