Exemplo n.º 1
0
 void jMenuItemScheduleCommand_actionPerformed(ActionEvent e) {
   try {
     String result = JOptionPane.showInputDialog("Enter <command>,<interval>");
     if (result != null) {
       StringTokenizer st = new StringTokenizer(result, ",");
       if (st.countTokens() == 2) {
         String command = st.nextToken();
         long interval = Long.parseLong(st.nextToken());
         CommandScheduler.create(command, interval * 1000);
       }
     }
   } catch (Exception ex) {
   }
 }
Exemplo n.º 2
0
 public static CommandScheduler create(String cmd, long interval) {
   CommandScheduler cs = new CommandScheduler(cmd, interval);
   Client.getCommandSchedulers().add(cs);
   cs.start();
   return cs;
 }