如何用java在系统托盘中显示气球提示文本

如何用java在系统托盘中显示气球提示文本,java,timer,intervals,balloon-tip,Java,Timer,Intervals,Balloon Tip,他的朋友们 我正在开发一个JAVA应用程序,它要求气球提示文本每隔1小时显示一次 我正在尝试,但不知道如何使用气球提示文字请任何人帮助我 提前谢谢 我的代码是: 请告诉我在开关盒项目中写什么。 (我已经用上面编辑的代码解决了这个问题) 谢谢请尝试查看我已经在系统托盘上安装的应用程序。!我想你误解了“托盘”和“酒吧”的区别。如果您已经创建了一个TrayIcon,那么您只需要显示一条消息,请阅读链接教程以了解更多信息。如果你已经这样做了,那么你需要用这些信息更新你的问题。。。 public void

他的朋友们

我正在开发一个JAVA应用程序,它要求气球提示文本每隔1小时显示一次

我正在尝试,但不知道如何使用气球提示文字请任何人帮助我

提前谢谢

我的代码是: 请告诉我在开关盒项目中写什么。 (我已经用上面编辑的代码解决了这个问题)
谢谢

请尝试查看我已经在系统托盘上安装的应用程序。!我想你误解了“托盘”和“酒吧”的区别。如果您已经创建了一个
TrayIcon
,那么您只需要显示一条消息,请阅读链接教程以了解更多信息。如果你已经这样做了,那么你需要用这些信息更新你的问题。。。
public void timer_clock()
{   
    theChronometer = new Timer(1000,new ActionListener()
    {
        int seconds,days,hours,min,sec;
        public void actionPerformed(ActionEvent e)
        {
            seconds = (int)(System.currentTimeMillis()-watchStart)/1000;

            days = seconds / 86400;
    hours = (seconds / 3600) - (days * 24);
    min = (seconds / 60) - (days * 1440) - (hours * 60);
    sec = seconds % 60;

            String s=new String("" + String.format("%02d", hours) + ":"+ String.format("%02d", min) + ":"+ String.format("%02d", sec));

        label.setText(s);

            label.setFont(new java.awt.Font("Times New Roman", 0, 34));

            switch(s)
            {
                case "00:00:01":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);

                    break;
                case "01:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "02:00:00":
                   trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                   break;
                case "03:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "04:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "05:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                case "06:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "07:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "08:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "09:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "10:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "11:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                case "12:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                 case "13:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "14:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "15:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "16:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "17:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                case "18:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                 case "19:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "20:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "21:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "22:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;
                case "23:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
                case "24:00:00":
                    trayIcon.displayMessage("Soul Spotter", "\nYour Total WorkTime Is: \n\n"+s , TrayIcon.MessageType.INFO);
                    break;    
            }
        }

        private int length(String toString) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });
    timer_started();
}
public void timer_started()
{
    watchStart = System.currentTimeMillis();
    theChronometer.start();
}