Package javax.swing

Examples of javax.swing.Timer


    mainPanel.add(p, BorderLayout.CENTER);
    // This panel
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel);
    // Timeout after specified time
    timer = new Timer(0, null);
    timer.setRepeats(false);
    timer.setInitialDelay(timeout);
    // Centre the splash
    pack();
    positionComponent(SwingConstants.CENTER, this);
View Full Code Here


    mainPanel.add(p, BorderLayout.CENTER);
    //  This panel
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel);
    //  Timeout after specified time
    timer = new Timer(0, null);
    timer.setRepeats(false);
    timer.setInitialDelay(timeout);
    //  Centre the splash
    pack();
    UIUtil.positionComponent(SwingConstants.CENTER, this);
View Full Code Here

          }
        };
      if (this.playbackTimer != null) {
        this.playbackTimer.stop();
      }
      this.playbackTimer = new Timer(1000 / 12, playbackAction);
      this.playbackTimer.setInitialDelay(0);
      this.playbackTimer.setCoalesce(false);
    }
    actionMap.get(ActionType.PLAYBACK).setEnabled(playable);
    actionMap.get(ActionType.RECORD).setEnabled(this.videoCreationExecutor == null);
View Full Code Here

                NavigationButton.this).requestFocusInWindow();
          }
        });
     
      // Create a timer that will update camera angles and location
      final Timer timer = new Timer(50, new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            controller.moveCamera(shiftDown ? moveDelta : moveDelta / 5);
            controller.rotateCameraYaw(shiftDown ? yawDelta : yawDelta / 5);
            controller.rotateCameraPitch(pitchDelta);
          }
        });
      timer.setInitialDelay(0);
     
      // Update camera when button is armed
      addChangeListener(new ChangeListener() {
          public void stateChanged(ChangeEvent ev) {
            if (getModel().isArmed()
                && !timer.isRunning()) {
              timer.restart();
            } else if (!getModel().isArmed()
                       && timer.isRunning()) {
              timer.stop();
           
          }
        });
      setFocusable(false);
      setBorder(null);
View Full Code Here

    this.numSteps = numSteps;
  }

  @Override
  public void actionPerformed(ActionEvent e) {
    Timer timer = (Timer) e.getSource();

    Point location = component.getLocation();
    int currentX = location.x;
    int currentY = location.y;
    if (currentX == x && currentY == y) {
      timer.stop();
    } else if (numSteps <= 1) {
      component.setLocation(x, y);
      done();
    } else {
      int diffX = x - currentX;
View Full Code Here

          addHome(createHome());
         
          if (showMemoryStatus) {
            final String memoryStatus = getUserPreferences().getLocalizedString(AppletApplication.class, "memoryStatus");
            // Launch a timer that displays memory used by the applet
            memoryStatusTimer = new Timer(1000, new ActionListener() {
                public void actionPerformed(ActionEvent ev) {
                  Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
                  if (focusOwner != null && SwingUtilities.isDescendingFrom(focusOwner, applet)) {
                    Runtime runtime = Runtime.getRuntime();
                    applet.showStatus(String.format(memoryStatus,
View Full Code Here

  }

  public void showTooltip(final JComponent comp, int timeoutMillis) {
    add(comp);

    new Timer(timeoutMillis, new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        remove(comp);
      }
    }).start();
View Full Code Here

  public void moveIn(int delay) {
    setLocation(getXWhenOut(), POSITION_Y);
    setVisible(true);
    _glassPane.add(this);
    final Timer timer = new Timer(10, new MoveComponentTimerActionListener(this, getXWhenIn(), POSITION_Y, 40) {
      @Override
      protected void done() {
      }
    });
    timer.setInitialDelay(delay);
    timer.start();
  }
View Full Code Here

    timer.setInitialDelay(delay);
    timer.start();
  }

  public void moveOut(int delay) {
    final Timer timer = new Timer(10, new MoveComponentTimerActionListener(this, getXWhenOut(), POSITION_Y, 40) {
      @Override
      protected void done() {
        LoginPanel loginPanel = LoginPanel.this;
        loginPanel.setVisible(false);
        _glassPane.remove(loginPanel);
      }
    });
    timer.setInitialDelay(delay);
    timer.start();
  }
View Full Code Here

    WidgetUtils.addToGridBag(new JLabel("Used memory:"), panel, 0, 2);
    WidgetUtils.addToGridBag(usedMemoryLabel, panel, 1, 2);
    WidgetUtils.addToGridBag(new JLabel("Free memory:"), panel, 0, 3);
    WidgetUtils.addToGridBag(freeMemoryLabel, panel, 1, 3);

    _updateMemoryTimer = new Timer(1000, new ActionListener() {
      private final Runtime runtime = Runtime.getRuntime();
      private final NumberFormat nf = NumberFormat.getIntegerInstance();

      @Override
      public void actionPerformed(ActionEvent e) {
View Full Code Here

TOP

Related Classes of javax.swing.Timer

Copyright © 2018 www.massapicom. 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.