List of usage examples for javax.swing Timer start
public void start()
Timer
, causing it to start sending action events to its listeners. From source file:storybook.action.ActionHandler.java
public void handleFileSave() {//new OK WaitDialog dlg = new WaitDialog(mainFrame, I18N.getMsg("msg.file.saving")); Timer timer = new Timer(500, new DisposeDialogAction(dlg)); timer.setRepeats(false);//w w w . jav a2 s. c o m timer.start(); SwingUtil.showModalDialog(dlg, mainFrame); }
From source file:storybook.SbApp.java
public void renameFile(final MainFrame mainFrame, File file) { trace("SbApp.renameFile(" + mainFrame.getName() + "," + file.getAbsolutePath() + ")"); try {//from ww w. ja va 2 s . co m FileUtils.copyFile(mainFrame.getDbFile().getFile(), file); DbFile dbFile = new DbFile(file); OpenFileAction act = new OpenFileAction("", dbFile); act.actionPerformed(null); Timer t1 = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mainFrame.close(); } }); t1.setRepeats(false); t1.start(); Timer t2 = new Timer(4000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mainFrame.getDbFile().getFile().delete(); } }); t2.setRepeats(false); t2.start(); } catch (IOException e) { error("SbApp.renameFile(" + mainFrame.getName() + "," + file.getName() + ")", e); } }
From source file:storybook.toolkit.swing.SwingUtil.java
/** * Flashes the given {@link Component} for 250 milliseconds. * * @param comp the component to flash/*from ww w .ja va 2 s .c o m*/ */ public static void flashComponent(JComponent comp) { synchronized (flashIsRunning) { if (flashIsRunning) return; flashIsRunning = true; FlashThread flash = new FlashThread(comp); SwingUtilities.invokeLater(flash); FlashThread flash2 = new FlashThread(comp, true); Timer timer = new Timer(1000, flash2); timer.setRepeats(false); timer.start(); } }