Search in sources :

Example 91 with Timer

use of javax.swing.Timer in project lotro-companion by dmorcellet.

the class AboutPanelController method buildContributorsPanel.

private JPanel buildContributorsPanel() {
    JPanel ret = GuiFactory.buildPanel(null);
    final List<JPanel> panels = buildToonPanels();
    int maxWidth = 0, maxHeight = 0;
    for (JPanel panel : panels) {
        Dimension d = panel.getPreferredSize();
        int width = d.width;
        if (width > maxWidth)
            maxWidth = width;
        int height = d.height;
        if (height > maxHeight)
            maxHeight = height;
        panel.setSize(d);
        panel.setVisible(false);
        ret.add(panel);
    }
    ret.setSize(maxWidth, maxHeight);
    ret.setPreferredSize(new Dimension(maxWidth, maxHeight));
    JPanel groupPanel = panels.get(panels.size() - 1);
    int x = (maxWidth - groupPanel.getWidth()) / 2;
    int y = (maxHeight - groupPanel.getHeight()) / 2;
    groupPanel.setLocation(x, y);
    panels.get(0).setVisible(true);
    ActionListener al = new ActionListener() {

        private int _index = 0;

        @Override
        public void actionPerformed(ActionEvent e) {
            JPanel oldPanel = panels.get(_index);
            oldPanel.setVisible(false);
            _index++;
            if (_index == panels.size())
                _index = 0;
            JPanel newPanel = panels.get(_index);
            newPanel.setVisible(true);
        }
    };
    _timer = new Timer(3000, al);
    _timer.setRepeats(true);
    _timer.start();
    return ret;
}
Also used : JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) Timer(javax.swing.Timer) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension)

Example 92 with Timer

use of javax.swing.Timer in project lotro-companion by dmorcellet.

the class FactionStatusEditionPanelController method triggerChartUpdateTimer.

private void triggerChartUpdateTimer() {
    if (_updateTimer == null) {
        ActionListener updateChart = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                _chart.updateData();
            }
        };
        _updateTimer = new Timer(100, updateChart);
        _updateTimer.setRepeats(false);
    }
    _updateTimer.restart();
}
Also used : ActionListener(java.awt.event.ActionListener) Timer(javax.swing.Timer) ActionEvent(java.awt.event.ActionEvent)

Example 93 with Timer

use of javax.swing.Timer in project lotro-companion by dmorcellet.

the class ProfessionStatusEditionPanelController method triggerChartUpdateTimer.

private void triggerChartUpdateTimer() {
    if (_updateTimer == null) {
        ActionListener updateChart = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                _chart.updateData();
            }
        };
        _updateTimer = new Timer(100, updateChart);
        _updateTimer.setRepeats(false);
    }
    _updateTimer.restart();
}
Also used : ActionListener(java.awt.event.ActionListener) Timer(javax.swing.Timer) ActionEvent(java.awt.event.ActionEvent)

Example 94 with Timer

use of javax.swing.Timer in project cytoscape-impl by cytoscape.

the class RoundedProgressBar method setIndeterminate.

public void setIndeterminate() {
    if (indet)
        return;
    indet = true;
    indetUpdate = new Timer(INDET_UPDATE_MS, new IndetUpdate());
    indetUpdate.start();
}
Also used : Timer(javax.swing.Timer)

Example 95 with Timer

use of javax.swing.Timer in project WorldPainter by Captain-Chaos.

the class Scroller method attach.

public void attach(JScrollBar scrollBar) {
    this.scrollBar = scrollBar;
    state = State.PAUSING_AT_START;
    pauseStart = System.currentTimeMillis();
    timer = new Timer(100, 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