本文整理了Java中javax.swing.Timer.addActionListener()
方法的一些代码示例,展示了Timer.addActionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.addActionListener()
方法的具体详情如下:
包路径:javax.swing.Timer
类名称:Timer
方法名:addActionListener
暂无
代码示例来源:origin: JetBrains/ideavim
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();
}
代码示例来源:origin: stackoverflow.com
for (CabPanel cp : fleet) {
control.add(cp);
timer.addActionListener(cp.listener);
代码示例来源:origin: org.tentackle/tentackle-swing
public void focusGained(FocusEvent e) {
flasher.addActionListener(this);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void startAnimation() {
//reset counter
stepsCounter = 0;
//register itself to timer
timer.addActionListener(this);
//start animation
timer.start();
}
代码示例来源:origin: xyz.cofe/gui.swing
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;
}
代码示例来源:origin: JetBrains/mapper
@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);
}
代码示例来源:origin: JetBrains/mapper
@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);
}
代码示例来源:origin: nroduit/Weasis
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();
}
代码示例来源:origin: Exslims/MercuryTrade
@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();
}
});
代码示例来源:origin: com.jidesoft/jide-oss
@Override
void startTimer() {
if (_synchronizedFlashTimer != null) {
_synchronizedFlashTimer.removeActionListener(this);
_synchronizedFlashTimer.addActionListener(this);
if (!_synchronizedFlashTimer.isRunning()) {
_synchronizedFlashTimer.start();
}
}
}
};
代码示例来源:origin: org.activecomponents.jadex/jadex-runtimetools-swing
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;
}
});
代码示例来源:origin: datacleaner/DataCleaner
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();
}
代码示例来源:origin: net.sourceforge.jadex/jadex-runtimetools-swing
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;
}
});
代码示例来源:origin: lbalazscs/Pixelitor
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();
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
protected Timer createTimer(int delay, ActionListener listener) {
if (_synchronizedFlashTimer == null) {
_synchronizedFlashTimer = new FlashTimer(delay, listener);
}
_synchronizedFlashTimer.removeActionListener(listener);
_synchronizedFlashTimer.addActionListener(listener);
return _synchronizedFlashTimer;
}
代码示例来源:origin: io.projectreactor.addons/reactor-extra
@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;
}
代码示例来源:origin: nroduit/Weasis
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();
}
代码示例来源:origin: io.projectreactor.addons/reactor-extra
@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;
}
代码示例来源:origin: stackoverflow.com
instance.addActionListener((ActionEvent e) -> {
代码示例来源:origin: LibraryOfCongress/bagger
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();
}
内容来源于网络,如有侵权,请联系作者删除!