Package javax.swing

Examples of javax.swing.Timer.addActionListener()


            {
                // Wait 1 sec and remove the progress bar from the main panel.
                Timer progressBarTimer = new Timer(1 * 1000, null);

                progressBarTimer.setRepeats(false);
                progressBarTimer.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)
                    {
                        mainPanel.remove(progressBar);
                        mainPanel.add(readyLabel, BorderLayout.SOUTH);
                        mainPanel.revalidate();
View Full Code Here


      public void actionPerformed(ActionEvent e) {
        DownloadProgressWindow.this.dispose();
        timer.stop();
      }
    };
    timer.addActionListener(listener);
    timer.start();

  }

}
View Full Code Here

  {
    harness.checkPoint("Adding/removing listeners");

    Timer t = new Timer(1, this);
    ActionListener other = new otherListener();
    t.addActionListener(other);

    harness.check(t.getActionListeners().length, 2, "must be 2 listeners");
    t.removeActionListener(this);

    harness.check(t.getActionListeners().length, 1, "must be 1 listener");
View Full Code Here

    if (!REPLAY_TEMP_DATA) {
      connectToCOMPort();
    }
    Timer updateTimer = new Timer(500, null);
    updateTimer.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
//     parseIncomingLine(TEMP_NODE_DATA[TEMP_COUNTER]);
//     TEMP_COUNTER = (TEMP_COUNTER + 1) % TEMP_NODE_DATA.length;
    try {
        updateCharts();
View Full Code Here

  });
    updateTimer.start();

    if (REPLAY_TEMP_DATA) {
  //      Timer updateTimer = new Timer(1000, null);
      updateTimer.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          parseIncomingLine(TEMP_NODE_DATA[TEMP_COUNTER]);
          TEMP_COUNTER = (TEMP_COUNTER + 1) % TEMP_NODE_DATA.length;
          updateCharts();
        }
View Full Code Here

            {
                // Wait 1 sec and remove the progress bar from the main panel.
                Timer progressBarTimer = new Timer(1 * 1000, null);

                progressBarTimer.setRepeats(false);
                progressBarTimer.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)
                    {
                        mainPanel.remove(progressBar);
                        mainPanel.add(readyLabel, BorderLayout.SOUTH);
                        mainPanel.revalidate();
View Full Code Here

            {
                // Wait 1 sec and remove the progress bar from the main panel.
                Timer progressBarTimer = new Timer(1 * 1000, null);

                progressBarTimer.setRepeats(false);
                progressBarTimer.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e)
                    {
                        mainPanel.remove(progressBar);
                        mainPanel.add(readyLabel, BorderLayout.SOUTH);
                        mainPanel.revalidate();
View Full Code Here

       * queue, and shall thus be the direct next event no matter which events are posted afterwards. The code with the ReleasedAction
       * handles if the Timer thread actually fires the action due to lags, by cancelling the action itself upon the PRESSED.
       */
      final Timer timer = new Timer(2, null);
      ReleasedAction action = new ReleasedAction(keyEvent, timer);
      timer.addActionListener(action);
      timer.start();

      _map.put(Integer.valueOf(keyEvent.getKeyCode()), action);

      // Consume the original
View Full Code Here

   
    private static final int SLIDE_INTERVAL = 1000/30;
    /** Animate the ghosted image returning to its origin. */
    public void returnToOrigin() {
        final Timer timer = new Timer(SLIDE_INTERVAL, null);
        timer.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Point location = dragImage.getLocationOnScreen();
                Point dst = new Point(origin);
                int dx = (dst.x - location.x)/2;
                int dy = (dst.y - location.y)/2;
View Full Code Here

          return;
        }

        final Timer timer = new Timer(100, null);
        final Mote mote = (Mote) obj;
        timer.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            /* Count down */
            if (timer.getDelay() < 90) {
              timer.stop();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.