ひえフレンズ。
バルーン ヒント テキストを 1 時間間隔で表示する必要がある Java アプリケーションを開発しています。
私はそれを試みていますが、バルーンチップテキストの使い方がわかりません。誰か助けてください。
前もって感謝します。
私のコードは次のとおりです。
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();
}
スイッチケースの項目に何を書くべきか教えてください。(編集された上記のコードでこれを解決しました)ありがとう