Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

show arrow in top JMenu

843804Oct 12 2004 — edited Nov 18 2004
The problem is that for top JMenu object there is no way to turn arrow on. Here is simple example:

import javax.swing.*;

public class A extends JFrame
{
public A()
{
super("Test");
JMenuBar bar = new JMenuBar();
JMenu menu = new JMenu("menu1")
{
// public boolean isTopLevelMenu()
// {
// return false;
// }
};
JMenuItem item = new JMenuItem("subitem");
menu.add(item);
bar.add(menu);
setJMenuBar(bar);
}

public static void main(String args[])
{
A a = new A();
a.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
a.pack();
a.setVisible(true);
}
}

In this example, JMenu object is top level and is shown without arrow. If I overload the isTopLevelMenu then MenuSelectionManager doesn't work anymore and JMenu object doesn't show popup window anymore. How to overcome this? Probably somebody aware about "right" solution? Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2004
Added on Oct 12 2004
7 comments
251 views