Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不想重新发明轮子,所以我想知道是否存在一些通知组件,比如 TrayIcon,我可以设置位置。示例:当我单击一个按钮时,在我的项目中显示按钮旁边的通知。
谢谢,
你自己发现的图书馆看起来不错。如果您想自己构建类似的东西,则需要JWindow用作基类;JFrame它是一个类似但没有边框的顶级窗口。您只需要相对于您的组件定位它。要获取组件的屏幕位置,您将使用SwingUtilities#convertPointToScreen. 然后,您可以根据需要进行设计并使用标准组件和布局管理器。
JWindow
JFrame
SwingUtilities#convertPointToScreen