This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How do you use javax.swing.Popup? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do you use javax.swing.Popup?" Watch "How do you use javax.swing.Popup?" New topic
Author

How do you use javax.swing.Popup?

Sebastion Hill
Ranch Hand

Joined: Jul 10, 2009
Posts: 48
I have a panel that displays a lot of information and is setup the way that I want it to look. I'm trying to get a window/JFrame to appear after a user clicks a button on the GUI already open. I want that new window to have the panel inside of it.

Should I be using JOptionPane.showOptionDialog or should I be using javax.swing.Popup? Could someone show a simple example of using javax.swing.Popup in action? Please :-)
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2090
    
    7
Question is far too vague, but I would guess you should use a JDialog.
Sebastion Hill
Ranch Hand

Joined: Jul 10, 2009
Posts: 48
Well I guess just an example of how one would make a JFrame appear as a Popup using javax.swing.Popup?

JPanel panel = new JPanel(); //contains my whole setup
JFrame frame = new JFrame();
frame.add(panel, BORDERLAYOUT.CENTER);
Popup popUp = new Popup();
popUp(frame,panel,100,100) ???
popUp.show();

...

I don't know how to use the Popup class. Can someone show me how I would use it with the code above?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Checkout PopupFactory API docs.
Also check out JPopupMenu.
You have already been suggested the JOptionPane.showXXXDialog


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you use javax.swing.Popup?
 
Similar Threads
GridBagLayout problem
Adding glassPane to a particular Panel in the window
Panel vs Frame
Finding X Y location of button
child panel