Package javax.swing

Examples of javax.swing.Timer$FiringEventRunnable


    jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    WindowInterface frame = new JFrameAdapter(jFrame);

    frame.add(packageProductionView.buildPanel());

    Timer t = new javax.swing.Timer(10000, new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        packageProductionViewHandler.refresh();
      }
    });
    t.start();

    frame.setVisible(true);
    loadDialog.dispose();

  }
View Full Code Here


          }
        }
      }
    }).start();

    Timer t = new javax.swing.Timer(5000, new ActionListener() {
      public void actionPerformed(ActionEvent e) {

        setUpLabels();
      }
    });
    t.start();

  }
View Full Code Here

   */
  private void initComponents() {
    labelIcon = new JLabel();
    labelIcon.setIcon(IconEnum.ICON_UGLAND.getIcon());
    progressBar = new JProgressBar();
    Timer timer = new Timer(500, this);
    timer.start();
  }
View Full Code Here

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                // wait 10 seconds before dismissing meter to prevent meter from
                // popping in and out of view
                if (dismissTimer == null) {
                    dismissTimer = new Timer(10000, new ActionListener() {
                       
                        public void actionPerformed(ActionEvent e) {
                            if (downloadingAssetMap.size() == 0) {
                                plugin.getHUDComponent().setVisible(false);
                                dismissTimer = null;
View Full Code Here

        // Removes a downloading asset from the list using a swing worker for
        // thread safeness
        final DownloadingAsset da = downloadingAssetMap.remove(
                asset.getAssetURI().toExternalForm());

        new Timer(750, new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                listModel.removeElement(da.indicator);
                ((Timer) e.getSource()).stop();
            }
View Full Code Here

          }
        }
      }
    });

    Timer ageTimer = new Timer(200, new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        if (maxAge > 0) {
          int oldThreads = 0;
          for (int i = 0; i < ec.getThreads(); i++) {
            int age = ec.getEvolutionsSinceDiscovery(i);
            if (age > maxAge) {
              oldThreads++;
            }
          }
          if (oldThreads == ec.getThreads()) {
            stop = true;
          }
        }

        if (timeLimit > 0) {
          double runningMinutes = (System.currentTimeMillis() - startTime) / 1000.0 / 60.0;
          if (runningMinutes > timeLimit) {
            stop = true;
          }
        }
      }
    });

    startTime = System.currentTimeMillis();
    ec.go();
    ageTimer.start();

    while (!stop) {
      Thread.sleep(200);
    }

    ageTimer.stop();
    ec.stopAllThreads();
    if (lastDetailed == null) {
      System.out.println(messages.getString("cli.noBuild"));
    } else {
      if (onlyOutputFinal) {
View Full Code Here

    gridBagConstraints.weightx = .5;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.gridy = gridy + 1;
    gridBagConstraints.insets = new Insets(1, 1, 1, 1);
    leftbottom.add(statusbar, gridBagConstraints);
    Timer t = new Timer(200, new ActionListener()
    {
      @Override
      public void actionPerformed(ActionEvent e)
      {
        if (timeStarted == 0)
          status1.setText(messages.getString("status.ready"));
        else
        {
          long ms = new Date().getTime() - timeStarted;
          long seconds = ms / 1000;
          long minutes = seconds / 60;
          long hours = minutes / 60;
          status1.setText(messages.getString("status.running", hours % 60, minutes % 60, seconds % 60));
        }
        if (lastUpdate != 0)
        {
          long ms = new Date().getTime() - lastUpdate;
          long seconds = ms / 1000;
          long minutes = seconds / 60;
          long hours = minutes / 60;
          status2.setText(messages.getString("status.lastUpdate", hours % 60, minutes % 60, seconds % 60));
          {
            double evaluations = ec.getGamesPlayed();
            double evalseconds = (System.currentTimeMillis() - timeStarted);
            evalseconds = evalseconds / 1000.0;
            double permsPerSecond = evaluations;
            permsPerSecond /= evalseconds;
            StringBuilder stats = new StringBuilder();
            int threadIndex = 0;
            stats.append(messages.getString("stats.gamesPlayed", evaluations / 1000));
                        stats.append("\n").append(messages.getString("stats.maxBuildOrderLength", ec.getChromosomeLength()));
                        stats.append("\n").append(messages.getString("stats.stagnationLimit", ec.getStagnationLimit()));
                        stats.append("\n").append(messages.getString("stats.gamesPlayedPerSec", (int) permsPerSecond));
                        stats.append("\n").append(messages.getString("stats.mutationRate", ec.getBaseMutationRate() / ec.getChromosomeLength()));
            for (Double d : ec.getBestScores())
                            stats.append("\n").append(messages.getString("stats.processor", threadIndex, ec.getEvolutionsSinceDiscovery(threadIndex++), d));
            statsText.setText(stats.toString());
          }
        }
        statusbar.repaint();
      }
    });
    t.start();
  }
View Full Code Here

      _searchField.setOpaque(false);
      _searchField.setBorder(BorderFactory.createEmptyBorder());
      _searchField.setCursor(getCursor());

      _searchField.getDocument().addDocumentListener(new DocumentListener() {
        private final Timer _timer = new Timer(200, new ActionListener() {
          public void actionPerformed(final ActionEvent e) {
            doFind();
          }
        });


        public void insertUpdate(final DocumentEvent e) {
          startTimer();
        }


        public void removeUpdate(final DocumentEvent e) {
          startTimer();
        }


        public void changedUpdate(final DocumentEvent e) {
          startTimer();
        }


        void doFind() {
          final String text = _searchField.getText().trim();
          if (!text.isEmpty()) {
            final int found = find(text);
            if (found == -1) {
              _noMatchForeground = getNoMatchForeground();
              _searchField.setForeground(_noMatchForeground);
              _toolBar.setVisible(false);
              remove(_toolBar);
              updatePopupBounds();
            } else {
              _searchField.setForeground(_foregroundColor);
              _toolBar.setVisible(true);
              add(_toolBar, BorderLayout.LINE_END);
              QuickSearch.this.setCursor(found);
              setSelectedElement(found);
              updatePopupBounds();
            }
          } else {
            hidePopup();
          }
        }


        void startTimer() {
          updatePopupBounds();
          if (getSearchDelay() > 0) {
            _timer.setInitialDelay(getSearchDelay());
            if (_timer.isRunning()) {
              _timer.restart();
            } else {
              _timer.setRepeats(false);
              _timer.start();
            }
          } else {
            doFind();
          }
        }
View Full Code Here

    label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.RED),
        BorderFactory.createEmptyBorder(8, 8, 8, 8)));
    label.setBackground(new Color(255, 0, 0, 125));
    label.setOpaque(true);

    final Timer t = new Timer(5000, new ClearErrorMessageAction(label));
    t.setRepeats(false);
    t.start();
    return label;
  }
View Full Code Here

      setBorder(BorderFactory.createLineBorder(SystemColor.controlShadow));
    }
    setFont(StyleContext.getDefaultStyleContext().getFont(getFont().getName(), Font.PLAIN, getFont().getSize() - 2));
    setHorizontalAlignment(JLabel.CENTER);

    timer = new Timer(500, new MemoryStatusUpdateAction());
    timer.setRepeats(true);
    timer.start();

    addMouseListener(new GarbageCollectorAction());
  }
View Full Code Here

TOP

Related Classes of javax.swing.Timer$FiringEventRunnable

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.