Search code examples
javaswingfocusjtextareajoptionpane

Changing focus (JTextArea and JOptionPane)


In Swing, I am able to prompt the user for input using JOptionPane. The only problem this presents is the fact that the user can't change focus between the input box and the frame/content within it.

Is there any parameter I can put in to make it so that the focus is always on the frame. As a note, I have already tried requestFocus().

Thank you in advance.


Solution

  • The JOptionPane dialog is always modal. U can check this:

    Can I use a Java JOptionPane in a non-modal way?

    in order to bypass this behaviour.