JPopupMenu disappears after use - please help.

  • Thread starter Dobieslaw Wroblewski
  • Start date
D

Dobieslaw Wroblewski

Hi.

I have a JFrame derived object frame and JPanel derived object panel.
There is one submenu in the frame's menu that is somewhat like the panel
properties. Let's call it a JMenu props;

I want the submenu to be accessible both from the frame's menu bar and (as a
popup) from the panel.
So in the panel class in the code for mouse right click I wrote something
like:
frame.props.getPopupMenu().show(this, e.getX(), e.getY())

The popup shows OK after right-button click in the panel, however it
disappears from the frame's menu (the submenu is present in the frame's menu
but it does not unfold after being shown in the panel for the first time).

What can I be doing wrong?

DW.
 
D

Dobieslaw Wroblewski

I tried copying the submenu to the popup:

Component ct[] = props.getMenuComponents();
JPopupMenu propsPopup = new JPopupMenu();
for ( int i = 0; i < ct.length; i++ )
propsPopup.add(ct);

Now the submenu (from the very beginning) unfolds to some window that is
about 1x1 pixel big :). The propsPopup shows normally.

I've got enough :-/.

DW.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top