Forums Register Login

How do you use javax.swing.Popup?

+Pie Number of slices to send: Send
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 :-)
+Pie Number of slices to send: Send
Question is far too vague, but I would guess you should use a JDialog.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
Checkout PopupFactory API docs.
Also check out JPopupMenu.
You have already been suggested the JOptionPane.showXXXDialog
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3500 times.
Similar Threads
Adding glassPane to a particular Panel in the window
GridBagLayout problem
Panel vs Frame
Finding X Y location of button
child panel
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:00:36.