Pop-up window in Java Swing

Gaurav Panwar picture Gaurav Panwar · Mar 8, 2010 · Viewed 43.3k times · Source

Can someone suggest me how to implement a pop-up window in Java Swing. I want the pop-up window to be a modal window (user cannot return to the main window when the pop-up is open).

I tried doing it using JDialog but it allows only one widget for user input to be in it whereas I need multiple widgets. I may be wrong here but this is what I was able to do.

Appreciate your help.

Answer

objects picture objects · Mar 8, 2010

Use a JDialog. There is no restiction on what you can add, you can add whatever you want to a JDialog (exactly the same as when using a JFrame)