| | |
Is there a JOptionPane Listener?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2004
Posts: 12
Reputation:
Solved Threads: 0
Hi all,
I have a JOptionPane with a YES button and a NO button. All I want to do is be able to press the left or right button on the keyboard to change the focus on the buttons. By using the mouse it works. Is there some kind of Listener I can use?
Here is my code :
====================================================
int response = JOptionPane.showConfirmDialog(null,"Are you sure you want to exit","Exit?",
JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE);
if(response == JOptionPane.YES_OPTION){
System.exit(1);
}else {
//do nothing
}
=====================================================
I have a JOptionPane with a YES button and a NO button. All I want to do is be able to press the left or right button on the keyboard to change the focus on the buttons. By using the mouse it works. Is there some kind of Listener I can use?
Here is my code :
====================================================
int response = JOptionPane.showConfirmDialog(null,"Are you sure you want to exit","Exit?",
JOptionPane.YES_NO_OPTION,JOptionPane.PLAIN_MESSAGE);
if(response == JOptionPane.YES_OPTION){
System.exit(1);
}else {
//do nothing
}
=====================================================
![]() |
Similar Threads
- MFC Listener (C)
- Java GUI JOptionPane.showMessageDialog (Java)
- Search Method help needed!!! (Java)
- Password Field in a JOptionPane (Java)
- JMF question: question about the unrealized player (Java)
Other Threads in the Java Forum
- Previous Thread: Jni
- Next Thread: how to include a .so file in c++ dll?
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu windows working






