java swing 添加菜单_Java / Swing:将项添加到系统菜单

这篇博客讨论了如何在Windows中访问和修改窗口的系统菜单,并提到在Swing中没有直接的方法来实现这一功能。作者建议使用JNI/JNA通过GetSystemMenu函数来实现对系统菜单的自定义,以便在Java应用中添加自定义菜单项。
摘要由CSDN通过智能技术生成

我忘了它的确切名称(我认为它是“系统菜单”),但在Windows中,窗口左上角有一个图标,如果单击它,弹出菜单就会变为可见:

有没有办法在Swing中添加自定义菜单项?

解决方法:

我不知道用纯Java / Swing直接做这个的方法.但是,您可以使用User32.dll中的JNI / JNA和GetSystemMenu函数对其进行修改.

Enables the application to access the window menu (also known as the system menu or the control menu) for copying and modifying.

实际上,Wikipedia在系统菜单上有一个很好的输入.

Some applications customize the system menu, typically through the GetSystemMenu WinAPI function.07003 Cmd.exe is an example of this and offers the user an ability to change its preferences through its system menu (other applications typically offer the user to change their preferences through the normal menu below their window’s title bar).

标签:java,swing,menu

来源: https://codeday.me/bug/20190630/1340473.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值