use of javax.swing.Timer in project JMRI by JMRI.
the class TwoIndexTcsProgrammerFacade method programmingOpReply.
// get notified of the final result
// Note this assumes that there's only one phase to the operation
@Override
public void programmingOpReply(int value, int status) {
if (log.isDebugEnabled()) {
log.debug("notifyProgListenerEnd value " + value + " status " + status);
}
if (_usingProgrammer == null) {
log.error("No listener to notify, reset and ignore");
state = ProgState.NOTPROGRAMMING;
return;
}
// Complete processing later so that WOWDecoder will go through a complete power on reset and not brown out between CV read/writes
int interval = 150;
ActionListener taskPerformer = new ActionListener() {
final int myValue = value;
final int myStatus = status;
@Override
public void actionPerformed(ActionEvent evt) {
processProgrammingOpReply(myValue, myStatus);
}
};
Timer t = new Timer(interval, taskPerformer);
t.setRepeats(false);
t.start();
}
use of javax.swing.Timer in project jdk8u_jdk by JetBrains.
the class Test6559154 method run.
public void run() {
Timer timer = new Timer(1000, this);
timer.setRepeats(false);
timer.start();
JColorChooser chooser = new JColorChooser();
setEnabledRecursive(chooser, false);
this.dialog = new JDialog();
this.dialog.add(chooser);
this.dialog.setVisible(true);
}
use of javax.swing.Timer in project jabref by JabRef.
the class MainTableSelectionListener method updatePreview.
private void updatePreview(final BibEntry toShow, final boolean changedPreview, int repeats) {
if (workingOnPreview) {
if (repeats > 0) {
// We've already waited once. Give up on this selection.
return;
}
Timer t = new Timer(50, actionEvent -> updatePreview(toShow, changedPreview, 1));
t.setRepeats(false);
t.start();
return;
}
EventList<BibEntry> list = table.getSelected();
// Check if the entry to preview is still selected:
if ((list.size() != 1) || (list.get(0) != toShow)) {
return;
}
final BasePanelMode mode = panel.getMode();
workingOnPreview = true;
SwingUtilities.invokeLater(() -> {
preview.setEntry(toShow);
// If nothing was already shown, set the preview and move the separator:
if (changedPreview || (mode == BasePanelMode.SHOWING_NOTHING)) {
panel.showPreview(preview);
panel.adjustSplitter();
}
workingOnPreview = false;
});
}
use of javax.swing.Timer in project JMRI by JMRI.
the class Diesel3Sound method newTimer.
protected Timer newTimer(long time, boolean repeat, ActionListener al) {
// make sure the time is > zero
time = Math.max(1, time);
t = new Timer((int) time, al);
t.setInitialDelay((int) time);
t.setRepeats(repeat);
return (t);
}
use of javax.swing.Timer in project JMRI by JMRI.
the class VSDSound method newTimer.
protected Timer newTimer(int time, boolean repeat, ActionListener al) {
// make sure the time is > zero
time = Math.max(1, time);
t = new Timer(time, al);
t.setInitialDelay(time);
t.setRepeats(repeat);
return (t);
}
Aggregations