public void startMappingTimer(@NotNull ActionListener actionListener) { final NumberOption timeoutLength = Options.getInstance().getNumberOption("timeoutlen"); if (timeoutLength != null) { myMappingTimer.setInitialDelay(timeoutLength.value()); } for (ActionListener listener : myMappingTimer.getActionListeners()) { myMappingTimer.removeActionListener(listener); } myMappingTimer.addActionListener(actionListener); myMappingTimer.start(); }
for (CabPanel cp : fleet) { control.add(cp); timer.addActionListener(cp.listener);
public void focusGained(FocusEvent e) { flasher.addActionListener(this); }
public void startAnimation() { //reset counter stepsCounter = 0; //register itself to timer timer.addActionListener(this); //start animation timer.start(); }
public static Closeable onActionPerformed( final Timer button, final Reciver<ActionEvent> consumer ){ if( button==null )throw new IllegalArgumentException( "button==null" ); if( consumer==null )throw new IllegalArgumentException( "consumer==null" ); final ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { consumer.recive(e); } }; button.addActionListener(al); Closeable cl = new Closeable() { @Override public void close() throws IOException { button.removeActionListener(al); }}; return cl; }
@Override public Registration scheduleRepeating(int period, final Runnable r) { Timer timer = new Timer(period, null); timer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { r.run(); } }); timer.start(); return timerReg(timer); }
@Override public Registration schedule(int delay, final Runnable r) { Timer timer = new Timer(delay, null); timer.setRepeats(false); timer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { r.run(); } }); timer.start(); return timerReg(timer); }
public synchronized void showUI() { this.alpha = 0.0f; final Timer timer = new Timer(3, null); timer.setRepeats(true); timer.addActionListener(e -> { alpha = Math.min(alpha + 0.1f, 1.0F); if (alpha >= 1.0) { timer.stop(); } xlayer.repaint(); }); this.xlayer.repaint(); timer.start(); }
@Override public void mouseExited(MouseEvent e) { if (!getBounds().contains(e.getPoint())) { setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1)); } timer = new Timer(1500, null); timer.addActionListener(action -> { timer.stop(); cell.setBorder(null); MercuryStoreUI.repaintSubject.onNext(ItemsGridFrame.class); }); timer.start(); } });
@Override void startTimer() { if (_synchronizedFlashTimer != null) { _synchronizedFlashTimer.removeActionListener(this); _synchronizedFlashTimer.addActionListener(this); if (!_synchronizedFlashTimer.isRunning()) { _synchronizedFlashTimer.start(); } } } };
public IFuture<Void> refresh() { final Future<Void> ret = new Future<Void>(); pp.getTextField("date").setText(new Date().toString()); final Timer timer = new Timer(1000, null); timer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { timer.stop(); ret.setResult(null); } }); timer.start(); return ret; } });
public void setFinished(final String filename) { final int index = getIndex(filename); final String doneText = "Done!"; _infoLabels[index].setText(doneText); for (int i = 0; i < _infoLabels.length; i++) { if (!doneText.equals(_infoLabels[i].getText())) { // return if not all files have transfered return; } } final Timer timer = new Timer(1500, null); final ActionListener listener = e -> { FileTransferProgressWindow.this.dispose(); timer.stop(); }; timer.addActionListener(listener); timer.start(); }
public IFuture<Void> refresh() { final Future<Void> ret = new Future<Void>(); pp.getTextField("date").setText(new Date().toString()); final Timer timer = new Timer(1000, null); timer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { timer.stop(); ret.setResult(null); } }); timer.start(); return ret; } });
public void startMarching() { if (frozen) { return; } assert !dead : "dead selection"; assert view != null : "no view in selection"; marchingAntsTimer = new Timer(100, null); marchingAntsTimer.addActionListener(evt -> { if(!hidden) { dashPhase += 1.0f / (float) view.getScaling(); repaint(); } }); marchingAntsTimer.start(); }
@Override protected Timer createTimer(int delay, ActionListener listener) { if (_synchronizedFlashTimer == null) { _synchronizedFlashTimer = new FlashTimer(delay, listener); } _synchronizedFlashTimer.removeActionListener(listener); _synchronizedFlashTimer.addActionListener(listener); return _synchronizedFlashTimer; }
@Override public Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) { Timer timer = new Timer((int)unit.toMillis(period), null); timer.setInitialDelay((int)unit.toMillis(initialDelay)); timer.addActionListener(e -> { try { task.run(); } catch (Throwable ex) { timer.stop(); Exceptions.throwIfFatal(ex); Operators.onErrorDropped(ex, Context.empty()); } }); timer.start(); return timer::stop; }
public synchronized void hideUI() { this.alpha = 1.0f; final Timer timer = new Timer(3, null); timer.setRepeats(true); timer.addActionListener(e -> { alpha = Math.max(alpha - 0.1f, 0.0F); if (alpha <= 0.0) { timer.stop(); parent.setContentPane(xlayer.getView()); return; } xlayer.repaint(); }); this.xlayer.repaint(); timer.start(); }
@Override public Disposable schedule(Runnable task, long delay, TimeUnit unit) { if (delay <= 0) { return schedule(task); } Timer timer = new Timer((int)unit.toMillis(delay), null); timer.setRepeats(false); timer.addActionListener(e -> { try { task.run(); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); Operators.onErrorDropped(ex, Context.empty()); } }); timer.start(); return timer::stop; }
instance.addActionListener((ActionEvent e) -> {
public void statusBarBegin(Progress progress, String message, String activityMonitored) { BusyIndicator.showAt(Application.instance().getActiveWindow().getControl()); task = new LongTask(); task.setActivityMonitored(activityMonitored); task.setProgress(progress); timer.addActionListener(new TimerListener()); progressMonitor = new ProgressMonitor(this.getControl(), message, "Preparing the operation...", 0, 1); progressMonitor.setMillisToDecideToPopup(ONE_SECOND); task.setMonitor(progressMonitor); task.go(); timer.start(); }