aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Problem of focus in JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem of focus in JOptionPane" Watch "Problem of focus in JOptionPane" New topic
Author

Problem of focus in JOptionPane

Mehdi Aboulkassim
Greenhorn

Joined: Nov 18, 2004
Posts: 1
Hye every one,

I have a application that uses a JOptionPane, and I`ve added mnemonics to some buttons.
The problem is that when a JOptionPane message appears, and after clicking in the Yes button, the mnemonics are like desabled (I think that the JOptionPane steals the focus).

I`ve tried the following:

int response = JOptionPane.showYesNoMessage(.....);

if(response == JOptionPane.OK_OPTION){
getFocusCycleRootAncestor().transferFocus();
}

It does work but I`m looking for a general solution because I`ve override the JOptionPane class and I use it in lots of other classes.

Thanks for your help.
 
 
subject: Problem of focus in JOptionPane