JOptionpane.showInputDialog
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Samar_Hossam
Posted On:   Tuesday, December 7, 2004 02:03 PM

Good day everyone, I have have two questions concerning Input Dialog Boxes and I would appreciate your help. First question: I have a frame containing only one button. If you click that button, an Input dialog box opens. I write anything and then want to press either the OK-button or the CANCEL-button. I don't want to use the mouse. Just the keyboard. Of course, I can navigate the focus using the TAB button, but then I have to press the space bar in order to "click the button". Well, I want to add the option that a user can press either the Space Bar or the more convenient ENTER key. How is that possible? Second question: whenever you call JoptionPane.sh   More>>

Good day everyone,

I have have two questions concerning Input Dialog Boxes and I would appreciate your help.



First question:

I have a frame containing only one button. If you click that button, an Input dialog box opens. I write anything and then want to press either the OK-button or the CANCEL-button. I don't want to use the mouse. Just the keyboard. Of course, I can navigate the focus using the TAB button, but then I have to press the space bar in order to "click the button".

Well, I want to add the option that a user can press either the Space Bar or the more convenient ENTER key. How is that possible?




Second question:

whenever you call JoptionPane.showInputDialog(...), the focus is automatically passed to the Input dialog box. I was checking a code written by another person and the problem was that whenever the JoptionPane.showInputDialog(...) method is called, the focus remains in the parent component. You have to press TAB first, before the focus gets transfered to the Input dialog box.

How can this be possible?

Is there a way to transfer the focus to the Input dialog box as soon as it appears? I read about the requestFocus method, but how can I use it with the input dialog box, when I don't instantiate it as an object?



Finally, I thank you so much for the time you spent reading my message. I hope you could help...


Regards,

Samar

   <<Less
About | Sitemap | Contact