通知最小化窗口小程序中发生的事件
我有一个用于聊天的 JApplet。我希望当小程序最小化并且用户收到聊天消息时,最小化的窗口变为橙色(从而向用户显示发生了某些事情)。
如何才能让小程序做到这一点?
谢谢, 蒂姆
I have a JApplet which is used for chat. I would like to make it possible that when the applet is minimised and a chat message is received by the user, the minimised window becomes orange (and thus shows the user that something has occurred).
How is it possible to make the applet do this?
Thanks,
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能可以在小程序中访问系统托盘(我不确定)。查看
java.awt。 SystemTray
类 - 托盘允许您向用户弹出消息。或者,您可以尝试调用
Window
的toFront
方法或使用setSize
方法“最大化”(同样,我'我不确定这对小程序有什么影响)。我怀疑toFront
方法将是一个不错的选择。我考虑的另一个选择是引发一个
JDialog
。它的存在可能会导致操作系统将注意力吸引到最小化的小程序。您可以监听代表屏幕未最小化的窗口事件来清除对话框,以便用户永远不知道它在那里。You may have access to the system tray in an applet (I'm not sure). Have a look at the
java.awt.SystemTray
class - the in-tray lets you pop up messages to the user.Alternatively you could attempt to cause the
Window
'stoFront
method to be called or to "maximize" using thesetSize
methods (again, I'm not sure what effect this has in an applet). I suspect that thetoFront
method will be a good betAnother option I'd look at is raising a
JDialog
. The presence of this may cause the OS to draw attention to the minimized applet. You could listen to window events representing the screen un-minimizing to clear the dialog so that the user never knew it was there.