JMenu子菜单小箭头图标指示器 [英] JMenu submenu little arrow icon indicator

查看:713
本文介绍了JMenu子菜单小箭头图标指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何控制JMenu子菜单上出现的小箭头的显示?

Does anyone know how to control the display of the tiny little arrow that appears on submenus of JMenu?

我可以更改吗?
可以禁用吗?
我可以移动它吗?

Can I change it? Can I disable it? Can I move it?

另外,我注意到这个箭头只有当它们是其他JMenu的子菜单时才出现在顶级JMenus上。这种不一致让我很烦,因为我混合了JMenuItem和JMenu附加到我的JMenuBar的根目录,所以我希望它总能表明它。无论如何也要这样做?

Also, I notice that this arrow doesn't appear on top level JMenus only when they are submenus of other JMenu. This inconsistency annoys me since I have a mix of JMenuItem and JMenu attached to the root of my JMenuBar and so I wish it would always indicate it. Anyway to do this as well?

谢谢!

推荐答案

Take看一下 Menu.arrowIcon UI属性

Take a look at the Menu.arrowIcon UI property

(感谢AndrewThompson的测试代码)。

(Thanks to AndrewThompson for the test code).

执行此操作将影响应用修改后创建的所有菜单。

Doining this will effect ALL the menus created AFTER you apply the modifications.

因此,在初始化外观之后,在创建任何菜单之前,请调用 UIManager.getLookAndFeelDefaults()。put(Menu.arrowIcon,null);

So after you init Look and Feel and before you create any menus call UIManager.getLookAndFeelDefaults().put("Menu.arrowIcon", null);

我想说我认为这是一个可怕的想法,并且会极力阻止你这样做。

I'd just like to say I think this is a terrible idea and would highly discourage you from doing it.

这篇关于JMenu子菜单小箭头图标指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆