show arrow in top JMenu
843804Oct 12 2004 — edited Nov 18 2004The 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.