user402642
user402642

Reputation:

Java Swing -- Asking for User Input (and creating a blocking thread) by popping up a JFrame

My top-level container is MainFrame (JFrame). I want to be able to popup another JFrame with a JPanel that has two JTextFields from MainFrame.

The thing is: I need to be able to block the EDT from the Swing GUI. This is reminscent of using a JOptionPane to block the EDT until the user has either hit OK or CANCEL.

The question is: Is it possible to create a "custom" JOptionPane with user-defined values that will block the EDT?

Thanks

Upvotes: 1

Views: 779

Answers (2)

user489041
user489041

Reputation: 28304

Look into JDialog

You can extend JDialog and call super in your constructor with the second parameter set to true


super(parent, true);   

Upvotes: 1

Matt
Matt

Reputation: 44078

Use a JDialog

You can set it to be modal in this JDialog(Frame, modal) constructor

Upvotes: 1

Related Questions