Search in sources :

Example 66 with Timer

use of javax.swing.Timer in project screenbird by adamhub.

the class Recorder method compileAudio.

/**
     * Compiles the audio recordings.
     */
public synchronized void compileAudio() {
    waitingForAudio = true;
    java.util.Timer timer = new java.util.Timer("Compile Audio Timer");
    timer.schedule(new TimerTask() {

        public void run() {
            audioRecorder.compileAudio(getWav());
            waitingForAudio = false;
        }
    }, 3000);
}
Also used : Timer(javax.swing.Timer) TimerTask(java.util.TimerTask)

Example 67 with Timer

use of javax.swing.Timer in project EnrichmentMapApp by BaderLab.

the class ControlPanelMediator method filterNodesAndEdges.

private void filterNodesAndEdges(EMViewControlPanel viewPanel, EnrichmentMap map) {
    CyNetworkView netView = viewPanel.getNetworkView();
    Timer timer = filterTimers.get(netView);
    if (timer == null) {
        timer = new Timer(0, new FilterActionListener(viewPanel, map, netView));
        timer.setRepeats(false);
        timer.setCoalesce(true);
        filterTimers.put(netView, timer);
    } else {
        for (ActionListener listener : timer.getActionListeners()) {
            if (listener instanceof FilterActionListener)
                ((FilterActionListener) listener).cancel();
        }
        timer.stop();
    }
    timer.setInitialDelay(250);
    timer.start();
}
Also used : Timer(javax.swing.Timer) ActionListener(java.awt.event.ActionListener) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 68 with Timer

use of javax.swing.Timer in project ACS by ACS-Community.

the class Manager method initializeGUI.

/**
	 * Initialize GUI.
	 */
public void initializeGUI() {
    setSize(320, 200);
    setLayout(new GridBagLayout());
    setTitle("ACS Manager");
    add(getRequestsProgressBar(), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(40, 40, 40, 40), 0, 0));
    guiUpdaterTimer = new Timer(GUI_UPDATE_INTERVAL, new GUIUpdater());
    guiUpdaterTimer.start();
    setLocationByPlatform(true);
    setVisible(true);
    toFront();
    addWindowListener(new WindowListener() {

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent)
			 */
        public void windowActivated(WindowEvent event) {
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)
			 */
        public void windowClosed(WindowEvent event) {
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
			 */
        public void windowClosing(WindowEvent event) {
            destroy();
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent)
			 */
        public void windowDeactivated(WindowEvent event) {
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent)
			 */
        public void windowDeiconified(WindowEvent event) {
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent)
			 */
        public void windowIconified(WindowEvent event) {
        }

        /* (non-Javadoc)
			 * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent)
			 */
        public void windowOpened(WindowEvent event) {
        }
    });
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) WindowListener(java.awt.event.WindowListener) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Timer(javax.swing.Timer) WindowEvent(java.awt.event.WindowEvent)

Example 69 with Timer

use of javax.swing.Timer in project adempiere by adempiere.

the class Waiting method init.

//  Waiting
/**
	 *  Common Initialize routine - does not create if timer == 1
	 *  @param text     Message to be displayed
	 *  @param canNotWait user can continue with other work
	 *  @param timer    timer ticks (seconds) - if less than 5 then 10
	 */
private void init(String text, boolean canNotWait, int timer) {
    log.fine(text + " - Sec=" + timer);
    //  don't show if 1 sec average
    if (timer == 1)
        return;
    try {
        jbInit();
        setText(text);
        if (!canNotWait)
            bDoNotWait.setVisible(false);
    } catch (Exception e) {
        log.log(Level.SEVERE, "Waiting", e);
    }
    //  set progress Bar
    progressBar.setMinimum(0);
    //  min 2 seconds
    progressBar.setMaximum(timer < 5 ? 10 : timer);
    //  Timer
    //  every second
    m_timer = new Timer(1000, this);
    m_timer.start();
    AEnv.showCenterWindow(getOwner(), this);
}
Also used : Timer(javax.swing.Timer)

Example 70 with Timer

use of javax.swing.Timer in project adempiere by adempiere.

the class AGlassPane method setBusyTimer.

//  getMessage
/**************************************************************************
	 *  Set and start Busy Counter if over 2 seconds
	 *  @param time in seconds
	 */
public void setBusyTimer(int time) {
    log.config("Time=" + time);
    //  should we display a progress bar?
    if (time < 2) {
        m_timermax = 0;
        if (isVisible())
            repaint();
        return;
    }
    m_timermax = time;
    m_timervalue = 0;
    //  Start Timer
    if (m_timer == null) {
        //  every second
        m_timer = new Timer(1000, this);
    }
    m_timer.start();
    if (!isVisible())
        setVisible(true);
    repaint();
}
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