use of javax.swing.Timer in project processdash by dtuma.
the class BackgroundTaskManager method doSuspend.
private void doSuspend(long delayMillis, long waitMillis) {
SUSPEND_PERMISSION.checkPermission();
BackgroundTaskExecutor bte;
synchronized (this) {
long newSuspendUntil = System.currentTimeMillis() + delayMillis;
this.suspendUntil = Math.max(this.suspendUntil, newSuspendUntil);
bte = currentTaskExecutor;
}
ActionListener taskRestarter = new ActionListener() {
public void actionPerformed(ActionEvent e) {
startExecutingTasks();
}
};
Timer t = new Timer((int) delayMillis + 5000, taskRestarter);
t.setRepeats(false);
t.start();
if (bte != null) {
if (waitMillis > 0)
bte.waitForTermination(waitMillis);
}
}
use of javax.swing.Timer in project vcell by virtualcell.
the class ServerManageConsole method getJFrameContentPane.
/**
* Return the JFrameContentPane property value.
* @return javax.swing.JPanel
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JPanel getJFrameContentPane() {
if (ivjJFrameContentPane == null) {
try {
ivjJFrameContentPane = new javax.swing.JPanel();
ivjJFrameContentPane.setName("JFrameContentPane");
ivjJFrameContentPane.setLayout(new java.awt.BorderLayout());
getJFrameContentPane().add(getTabbedPane(), "Center");
JPanel panel = new javax.swing.JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
panel.add(getExitButton());
panel.add(getRefreshButton(), getRefreshButton().getName());
final JLabel timeLabel = new JLabel(" ");
timeLabel.setFont(new Font(timeLabel.getFont().getName(), Font.BOLD, timeLabel.getFont().getSize()));
Box box = Box.createHorizontalBox();
box.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()));
box.add(panel);
box.add(Box.createHorizontalGlue());
box.add(timeLabel);
box.add(Box.createHorizontalGlue());
box.add(getProgressBar());
final DateFormat df = new SimpleDateFormat("HH:mm:ss EEEE MMM dd, yyyy");
new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
timeLabel.setText(df.format(new Date()));
}
}).start();
getJFrameContentPane().add(box, "North");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjJFrameContentPane;
}
use of javax.swing.Timer in project opticus-project by MrXnight.
the class Animation method scroll.
/**
* Méthode qui permet le scroll automatique du text
*/
public void scroll() {
// On met un delai de 30 ms pour le scroll-auto
int timerDelay = 30;
running = true;
// On créer un timer qui permet le scroll
new Timer(timerDelay, new ActionListener() {
public void actionPerformed(ActionEvent e) {
// On place le curseur de la scroll bar à l'indice i et on incrémente
scroll.getVerticalScrollBar().setValue(i);
if (versLeBas) {
i++;
} else {
i--;
}
if (i >= scroll.getVerticalScrollBar().getHeight() * 2.4 || i <= 0) {
running = false;
((Timer) e.getSource()).stop();
}
}
}).start();
}
use of javax.swing.Timer in project cytoscape-impl by cytoscape.
the class NetworkViewContainer method init.
private void init() {
setFocusable(true);
setRequestFocusEnabled(true);
final JPanel glassPane = new JPanel(null);
getRootPane().setGlassPane(glassPane);
glassPane.setOpaque(false);
glassPane.setVisible(true);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(getVisualizationContainer(), BorderLayout.CENTER);
getContentPane().add(getToolBar(), BorderLayout.SOUTH);
setKeyBindings(this);
setKeyBindings(getRootPane());
updateTollBar();
updateBirdsEyeViewPanel();
glassPane.add(getBirdsEyeViewPanel());
resizeTimer = new Timer(0, new ResizeActionListener());
resizeTimer.setRepeats(false);
resizeTimer.setCoalesce(true);
resizeTimer.start();
}
use of javax.swing.Timer in project cytoscape-impl by cytoscape.
the class NetworkViewMediator method handleEvent.
@Override
public void handleEvent(NetworkViewAboutToBeDestroyedEvent nvde) {
final CyNetworkView view = nvde.getNetworkView();
Timer timer = null;
synchronized (lock) {
timer = viewUpdateTimers.remove(view);
}
if (timer != null)
timer.stop();
removeView(view);
}
Aggregations