Search in sources :

Example 81 with Timer

use of javax.swing.Timer in project processdash by dtuma.

the class BackgroundTaskManager method startPeriodicExecutor.

private void startPeriodicExecutor() {
    int millisPerHour = 60 * /* minutes */
    60 * /* seconds */
    1000;
    ActionListener periodicTaskInitiator = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            queueScheduledTasks(false);
        }
    };
    Timer t = new Timer(millisPerHour, periodicTaskInitiator);
    t.start();
}
Also used : ActionListener(java.awt.event.ActionListener) Timer(javax.swing.Timer) ActionEvent(java.awt.event.ActionEvent)

Example 82 with Timer

use of javax.swing.Timer in project processdash by dtuma.

the class TaskDependencyCellEditor method buttonClicked.

public void buttonClicked() {
    if (errMsg != null) {
        JOptionPane.showMessageDialog(null, errMsg, "Operation Not Allowed", JOptionPane.ERROR_MESSAGE);
        errMsg = null;
        cancelCellEditing();
        return;
    }
    closedProgrammatically = false;
    int userResponse = setupAndShowDialog();
    if (closedProgrammatically || userResponse == JOptionPane.OK_OPTION) {
        unloadUIData();
        stopCellEditing();
    } else {
        cancelCellEditing();
    }
    Timer t = new Timer(100, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            parentTable.grabFocus();
        }
    });
    t.setRepeats(false);
    t.start();
}
Also used : Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 83 with Timer

use of javax.swing.Timer in project processdash by dtuma.

the class AddTaskDialog method deferredSetActiveTask.

private void deferredSetActiveTask(final PropertyKey newNode) {
    // our hierarchy alterations will trigger a "hierarchy changed" event,
    // but that event won't fire until 300 ms after the changes occurred.
    // wait a little longer, then make the new task the active one.
    Timer t = new Timer(500, new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            dash.getActiveTaskModel().setNode(newNode);
        }
    });
    t.setRepeats(false);
    t.start();
}
Also used : Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent)

Example 84 with Timer

use of javax.swing.Timer in project processdash by dtuma.

the class TimeLogEditor method createRecalcTimer.

private void createRecalcTimer() {
    recalcTimer = new Timer(1000, (ActionListener) EventHandler.create(ActionListener.class, this, "setTimes"));
    recalcTimer.setRepeats(false);
    recalcTimer.setInitialDelay(100);
}
Also used : Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener)

Example 85 with Timer

use of javax.swing.Timer in project jgnash by ccavanaugh.

the class BusyLayerUI method start.

public void start() {
    if (isRunning) {
        return;
    }
    // Run a thread for animation.
    isRunning = true;
    fadeInStart = System.currentTimeMillis();
    fadeOutStart = 0;
    timer = new Timer(TIMER_TICK, this);
    timer.start();
}
Also used : Timer(javax.swing.Timer)

Aggregations

Timer (javax.swing.Timer)130 ActionEvent (java.awt.event.ActionEvent)66 ActionListener (java.awt.event.ActionListener)62 IOException (java.io.IOException)12 JPanel (javax.swing.JPanel)12 JLabel (javax.swing.JLabel)11 BorderLayout (java.awt.BorderLayout)9 Dimension (java.awt.Dimension)9 Point (java.awt.Point)9 Color (java.awt.Color)8 JCheckBox (javax.swing.JCheckBox)8 MouseEvent (java.awt.event.MouseEvent)7 JFrame (javax.swing.JFrame)7 MouseAdapter (java.awt.event.MouseAdapter)6 Window (java.awt.Window)5 JButton (javax.swing.JButton)5 JDialog (javax.swing.JDialog)5 JScrollPane (javax.swing.JScrollPane)5 File (java.io.File)4 Date (java.util.Date)4