简体   繁体   English

改善java.awt.PopupMenu和java.awt.MenuItem的外观?

[英]Improving the appearance of java.awt.PopupMenu and java.awt.MenuItem?

I'm trying to add a system tray icon, with a right click menu on the icon, for a javafx program. 我正在尝试为javafx程序添加系统任务栏图标,并在该图标上单击右键菜单。

The answers I've found indicate that the only way to do this is via java.awt.SystemTray 我找到的答案表明,唯一的方法是通过java.awt.SystemTray

Which is fine, but the popup menu which shows up when I right click the icon in tray, looks very bland. 很好,但是当我右键单击任务栏中的图标时显示的弹出菜单看起来很平淡。 Also, if I hover the mouse over any of the popup menu options, I expect the background color of that option to change, to indicate that I'm selecting it. 另外,如果将鼠标悬停在任何弹出菜单选项上,则希望该选项的背景颜色发生变化,以表示我正在选择它。 But this doesn't happen, the menu stays completely static and unchanging until I click an option. 但这不会发生,在我单击某个选项之前,菜单将保持完全静态且不变。

I'm looking for a way that I can listen to the mouseover event on a MenuItem and change its background + foreground color to indicate that it has the focus. 我正在寻找一种方法,可以侦听MenuItem上的mouseover事件并更改其背景+前景色以指示其具有焦点。 But I can't find any methods in the API that let you do this. 但是我在API中找不到任何可以让您做到这一点的方法。 Is there any other way? 还有其他办法吗? Or is there anything else I can do to make the menu seem a bit more responsive? 还是我可以做些其他的事情来使菜单显得更具响应性?

Try this link 试试这个连结

you can get some help here 你可以在这里得到一些帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM