如何增加java.awt.SystemTray的显示超时?

时间:2018-02-06 10:35:19

标签: java awt trayicon

我使用以下代码通过我的应用程序在屏幕上显示系统托盘。但我无法找到如何增加显示超时。任何人都可以帮忙吗?

  SystemTray tray = SystemTray.getSystemTray();

        //If the icon is a file
        Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
        //Alternative (if the icon is on the classpath):
        //Image image = Toolkit.getToolkit().createImage(getClass().getResource("icon.png"));
        TrayIcon trayIcon = new TrayIcon(image, "Tray Demo");
        //Let the system resizes the image if needed
        trayIcon.setImageAutoSize(true);
        //Set tooltip text for the tray icon
        trayIcon.setToolTip("System tray icon demo");
        tray.add(trayIcon);

        trayIcon.displayMessage("Applicaiton ver 4", "Launching Application... \nPlease wait for a while !!!", MessageType.INFO);

0 个答案:

没有答案