微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.swing.Timer的实例源码

项目:incubator-netbeans    文件BalloonManager.java   
synchronized void startdismisstimer (int timeout) {
    stopdismisstimer();
    currentAlpha = 1.0f;
    dismisstimer = new Timer(disMISS_REPAINT_REPEAT,new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            currentAlpha -= ALPHA_DECREMENT;
            if( currentAlpha <= ALPHA_DECREMENT ) {
                stopdismisstimer();
                dismiss();
            }
            repaint();
        }
    });
    dismisstimer.setinitialDelay (timeout);
    dismisstimer.start();
}
项目:incubator-netbeans    文件WeakTimerListener.java   
public void actionPerformed(ActionEvent evt) {
    ActionListener src = (ActionListener)ref.get();
    if (src != null) {
        src.actionPerformed(evt);

    } else { // source listener was garbage collected
        if (evt.getSource() instanceof Timer) {
            Timer timer = (Timer)evt.getSource();
            timer.removeActionListener(this);

            if (stopTimer) {
                timer.stop();
            }
        }
    }
}
项目:incubator-netbeans    文件memoryview.java   
/**
 * Initializes the Form
 */
public memoryview() {
    initComponents();

    setTitle(bundle.getString("TXT_TITLE"));
    doGarbage.setText(bundle.getString("TXT_GARBAGE"));
    doRefresh.setText(bundle.getString("TXT_REFRESH"));
    doClose.setText(bundle.getString("TXT_CLOSE"));

    txtTime.setText(bundle.getString("TXT_TIME"));
    doTime.setText(bundle.getString("TXT_SET_TIME"));
    time.setText(String.valueOf(UPDATE_TIME));
    time.selectAll();
    time.requestFocus();

    updateStatus();

    timer = new Timer(UPDATE_TIME,new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            updateStatus();
        }
    });
    timer.setRepeats(true);

    pack();
}
项目:incubator-netbeans    文件AnnotationBar.java   
void annotate(final List<Location> locations) {
    doc.render(new Runnable() {
        @Override
        public void run() {
            StyledDocument sd = (StyledDocument) doc;
            elementAnnotations = new HashMap<Integer,Location>();
            for (Location loc : locations) {
                int line = NbDocument.findLineNumber(sd,loc.startOffset);
                elementAnnotations.put(line,loc);
                //for multiline values like <parent> or <organization>
                int endline = NbDocument.findLineNumber(sd,loc.endOffset);
                if (endline != line && !elementAnnotations.containsKey(endline)) {
                    elementAnnotations.put(endline,loc);
                }
            }
        }
    });
    caret.addchangelistener(this);
    this.caretTimer = new Timer(500,this);
    caretTimer.setRepeats(false);

    onCurrentLine();
    revalidate();        
}
项目:incubator-netbeans    文件SearchHistoryPanel.java   
/** Creates new form SearchHistoryPanel */
public SearchHistoryPanel(File [] roots,SearchCriteriaPanel criteria) {
    this.roots = roots;
    this.repositoryUrl = null;
    this.criteria = criteria;
    this.diffViewFactory = new SearchHistoryTopComponent.DiffResultsViewFactory();
    criteriaVisible = true;
    explorerManager = new ExplorerManager ();
    initComponents();
    initializefilter();
    filterTimer = new Timer(500,this);
    filterTimer.setRepeats(false);
    filterTimer.stop();
    aquaBackgroundWorkaround();
    setupComponents();
    refreshComponents(true);
}
项目:incubator-netbeans    文件TooltipHack.java   
/** Hack to invoke tooltip on given JComponent,with given dismiss delay.
 * Triggers <br>
 * <code>comp.getToolTipText(MouseEvent)</code> and 
 * <code>comp.getToolTipLocation(MouseEvent)</code> with fake mousemoved 
 * MouseEvent,set to given coordinates.
 */
public static void invokeTip (JComponent comp,int x,int y,int dismissDelay) {
    final ToolTipManager ttm = ToolTipManager.sharedInstance();
    final int prevInit = ttm.getinitialDelay();
    prevdismiss = ttm.getdismissDelay();
    ttm.setinitialDelay(0);
    ttm.setdismissDelay(dismissDelay);

    MouseEvent fakeEvt = new MouseEvent(
            comp,MouseEvent.MOUSE_MOVED,System.currentTimeMillis(),x,y,false);
    ttm.mouseMoved(fakeEvt);

    ttm.setinitialDelay(prevInit);
    Timer timer = new Timer(20,instance());
    timer.setRepeats(false);
    timer.start();
}
项目:incubator-netbeans    文件DragWindow.java   
private Timer createInitialEffect() {
    final Timer timer = new Timer(100,null);
    timer.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if( contentAlpha < 1.0f ) {
                contentAlpha += ALPHA_INCREMENT;
            } else {
                timer.stop();
            }
            if( contentAlpha > 1.0f )
                contentAlpha = 1.0f;
            repaintimageBuffer();
            repaint();
        }
    });
    timer.setinitialDelay(0);
    return timer;
}
项目:incubator-netbeans    文件DragWindow.java   
private Timer createNoDropEffect() {
    final Timer timer = new Timer(100,null);
    timer.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if( contentAlpha > NO_DROP_ALPHA ) {
                contentAlpha -= ALPHA_INCREMENT;
            } else {
                timer.stop();
            }
            if( contentAlpha < NO_DROP_ALPHA )
                contentAlpha = NO_DROP_ALPHA;
            repaintimageBuffer();
            repaint();
        }
    });
    timer.setinitialDelay(0);
    return timer;
}
项目:java-course    文件LjstatusBar.java   
/**
 * Initializes status bar GUI.
 */
private void initGUI() {
    setLayout(new BoxLayout(this,BoxLayout.X_AXIS));

    length = new JLabel(lp.getString("length") + ": 0");
    line = new JLabel(lp.getString("line") + ": 1");
    column = new JLabel(lp.getString("column") + ": 0");
    selection = new JLabel(lp.getString("length") + ": 0");
    time = new JLabel();

    add(length);
    add(Box.createHorizontalglue());

    add(line);
    add(Box.createRigidArea(new Dimension(5,0)));
    add(column);
    add(Box.createRigidArea(new Dimension(5,0)));
    add(selection);
    add(Box.createHorizontalglue());
    add(time);

    timer = new Timer(500,timerListener);
    timer.start();
}
项目:incubator-netbeans    文件GraPHPanel.java   
private void disableSelection() {
    // Another disableSelection() in progress?
    if (timerRunning) return;
    timerRunning = true;

    // Tooltip is hidden when its location changes,let's wait for a while
    Timer timer = new Timer(50,new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (!isTooltipShowing()) {
                chart.getSelectionModel().
                           setHoverMode(ChartSelectionModel.HOVER_NONE);
                chart.setToolTipText(NO_DATA_TOOLTIP);
            }
            timerRunning = false;
        }
    });
    timer.setRepeats(false);
    timer.start();
}
项目:chipKIT-importer    文件ImportWorker.java   
@Override
public Set<FileObject> doInBackground() {
    try {
        return invokeImporterTasks();
    } catch (Exception ex) {
        this.exception = ex;
        LOGGER.log( Level.SEVERE,"Failed to import project",ex );
        final File projectDir = (File) wizardDescriptor.getProperty(WizardProperty.PROJECT_DIR.key());
        // Delete the project directory after a short delay so that the import process releases all project files.
        Timer t = new Timer(2000,(a) -> {                
            try {
                deleteExistingProject(projectDir);
            } catch (IOException ex1) {
                LOGGER.log( Level.SEVERE,"Failed to delete an incompletely imported project",ex1 );
            }
        });
        t.setRepeats(false);
        t.start();
        return new HashSet<>();
    }
}
项目:incubator-netbeans    文件BranchSelector.java   
public BranchSelector (File repository) {
    this.repository = repository;
    panel = new BranchSelectorPanel();
    panel.branchList.setCellRenderer(new RevisionRenderer());

    filterTimer = new Timer(300,new ActionListener() {
        @Override
        public void actionPerformed (ActionEvent e) {
            filterTimer.stop();
            applyFilter();
        }
    });
    panel.txtFilter.getDocument().addDocumentListener(this);
    panel.branchList.addListSelectionListener(this);
    panel.jPanel1.setVisible(false);
    cancelButton = new JButton();
    org.openide.awt.Mnemonics.setLocalizedText(cancelButton,org.openide.util.NbBundle.getMessage(BranchSelector.class,"CTL_BranchSelector_Action_Cancel")); // NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(BranchSelector.class,"ACSD_BranchSelector_Action_Cancel")); // NOI18N
    cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(BranchSelector.class,"ACSN_BranchSelector_Action_Cancel")); // NOI18N
}
项目:rapidminer    文件SystemMonitor.java   
public void startMonitorThread() {
    new Timer(DELAY,new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!SystemMonitor.this.isShowing()) {
                return;
            }
            // memory
            SystemMonitor.this.currentlyUsed = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
            SystemMonitor.this.memory[SystemMonitor.this.currentMeasurement] = (long) currentlyUsed;
            SystemMonitor.this.currentMeasurement = (SystemMonitor.this.currentMeasurement + 1)
                    % SystemMonitor.this.memory.length;
            SystemMonitor.this.repaint();
        }
    }).start();
}
项目:rapidminer    文件SplashScreen.java   
public SplashScreen(Image productlogo,Properties properties) {
    this.properties = properties;
    this.productlogo = productlogo;
    this.productName = I18N.getGUIMessage("gui.splash.product_name");

    splashScreenFrame = new JFrame(properties.getProperty("name"));
    splashScreenFrame.getContentPane().add(this);
    SwingTools.setFrameIcon(splashScreenFrame);

    splashScreenFrame.setUndecorated(true);
    if (backgroundImage != null) {
        splashScreenFrame.setSize(backgroundImage.getWidth(this),backgroundImage.getHeight(this));
    } else {
        splashScreenFrame.setSize(550,400);
    }
    splashScreenFrame.setLocationRelativeto(null);

    animationTimer = new Timer(10,this);
    animationTimer.setRepeats(true);
    animationTimer.start();
}
项目:routerapp    文件LineHighlightEffect.java   
/**
 * 
 */
public LineHighlightEffect(Shape shape,Graphics2D graphics,int length,ViselPane viselPane,boolean continuous) {
    this.shape = shape;
    this.length = length;
    this.graphics = graphics;
    this.viselPane = viselPane;
    this.continuous = continuous;

    timer = new Timer(length/10,this);
    duration = 0;
    stroke = (Basicstroke) graphics.getstroke();
    currentlinewidth =
        initiallinewidth = stroke.getlinewidth();

}
项目:marathonv5    文件TumbleItem.java   
public void init() {
    loadAppletParameters();

    // Execute a job on the event-dispatching thread:
    // creating this applet's GUI.
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                createGUI();
            }
        });
    } catch (Exception e) {
        System.err.println("createGUI didn't successfully complete");
    }

    // Set up timer to drive animation events.
    timer = new Timer(speed,this);
    timer.setinitialDelay(pause);
    timer.start();

    // Start loading the images in the background.
    worker.execute();
}
项目:CRS    文件ControllerPrincipal.java   
private void destacarCampo(jformattedtextfield field) {
  final int timerDelay = 500;
  final int totalTime = 2000;

  final int totalCount = totalTime / timerDelay;
  Timer timer = new Timer(timerDelay,new ActionListener(){
    int count = 0;

    public void actionPerformed(ActionEvent evt) {
      if (count % 2 == 0) {
        field.setBorder(new LineBorder(Color.RED,2,true));
        field.requestFocus();
      } else {
            field.setBorder(new LineBorder(Color.GRAY,1,false));
        if (count >= totalCount) { 
          ((Timer)evt.getSource()).stop();
        }
      }
      count++;
    }
  });
  timer.start();
}
项目:VASSAL-src    文件BugDialog.java   
@Override
protected Void doInBackground() throws Exception {
  final CountDownLatch latch = new CountDownLatch(1);

  // Wait 3 seconds before counting down the latch to ensure
  // that the user has sufficient time to read the message on
  // the first pane.
  timer = new Timer(2000,new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      latch.countDown();
    }
  });
  timer.start();

  // Make the request to the server and wait for the latch.
  BugUtils.sendBugReport(
    emailField.getText(),descriptionArea.getText(),errorLog,thrown
  );

  latch.await();
  return null;
}
项目:Decompiledminecraft    文件StatsComponent.java   
public StatsComponent(minecraftServer p_i2367_1_)
{
    this.field_120037_e = p_i2367_1_;
    this.setPreferredSize(new Dimension(456,246));
    this.setMinimumSize(new Dimension(456,246));
    this.setMaximumSize(new Dimension(456,246));
    (new Timer(500,new ActionListener()
    {
        public void actionPerformed(ActionEvent p_actionPerformed_1_)
        {
            StatsComponent.this.func_120034_a();
        }
    })).start();
    this.setBackground(Color.BLACK);
}
项目:FreeCol    文件DeclarationPanel.java   
/**
 * Starts the animation of the signature.  An
 * {@code ActionEvent} gets sent to the registered
 * listeners when the animation has stopped.
 * 
 * @see #addActionListener(ActionListener)
 */
public void startAnimation() {
    ActionListener taskPerformer = (ActionEvent ae) -> {
        if (counter < points.length - 1) {
            counter += 20;
            if (counter > points.length) {
                counter = points.length - 1;
                ((Timer)ae.getSource()).stop();
                notifyStopped();
            }
            validate();
            repaint();
        } else {
            ((Timer)ae.getSource()).stop();
            notifyStopped();
        }
    };
    new Timer(ANIMATION_DELAY,taskPerformer).start();
}
项目:incubator-netbeans    文件NotificationCenterTopComponent.java   
public NotificationCenterTopComponent() {
    notificationmanager = NotificationCenterManager.getInstance();
    filterCallback = new QuickFilterCallback();
    tableRefreshTimer = new Timer(TABLE_REFRESH_PERIOD,new RefreshTimerListener());
    tableRefreshTimer.stop();
    tableKeyListener = new TableKeyListener();
    italicFont = new JLabel().getFont().deriveFont(Font.ITALIC);
    setName(NbBundle.getMessage(NotificationCenterTopComponent.class,"CTL_NotificationCenterTopComponent"));
    setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class,"HINT_NotificationCenterTopComponent"));
}
项目:incubator-netbeans    文件ProgressLabel.java   
private void setupProgress() {
    setIcon(createProgressIcon());
    t = new Timer(100,new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Component comp = refComp.get();
            TreeListNode nd = refNode.get();
            if (nd == null && comp == null) {
                t.stop();
                Container p = getParent();
                if (p != null) {
                    p.remove(ProgressLabel.this);
                }
            } else {
                busyIcon.tick();
                ProgressLabel.this.repaint();
                if (nd != null) {
                    nd.fireContentChanged();
                } else {
                    comp.repaint();
                }
            }
        }
    });
    t.setRepeats(true);
    super.setVisible(false);
}
项目:incubator-netbeans    文件ToolTipSupport.java   
/** Construct new support for tooltips.
     */
//    @SuppressWarnings({"OverridableMethodCallInConstructor","LeakingThisInConstructor"}) //NOI18N
    @PatchedPublic
    /* package */ ToolTipSupport(EditorUI extEditorUI) {
        this.extEditorUI = extEditorUI;

        enterTimer = new Timer(INITIAL_DELAY,new WeakTimerListener(listener));
        enterTimer.setRepeats(false);
        exitTimer = new Timer(disMISS_DELAY,new WeakTimerListener(listener));
        exitTimer.setRepeats(false);

        extEditorUI.addPropertychangelistener(listener);

        setEnabled(true);
    }
项目:jdk8u-jdk    文件AquaScrollBarUI.java   
public void actionPerformed(final ActionEvent e) {
    if (fUseBlockIncrement) {
        Hit newPart = getPartHit(fTrackListener.fCurrentMouseX,fTrackListener.fCurrentMouseY);

        if (newPart == ScrollBarHit.TRACK_MIN || newPart == ScrollBarHit.TRACK_MAX) {
            final int newDirection = (newPart == ScrollBarHit.TRACK_MAX ? 1 : -1);
            if (fDirection != newDirection) {
                fDirection = newDirection;
            }
        }

        scrollByBlock(fDirection);
        newPart = getPartHit(fTrackListener.fCurrentMouseX,fTrackListener.fCurrentMouseY);

        if (newPart == ScrollBarHit.THUMB) {
            ((Timer)e.getSource()).stop();
        }
    } else {
        scrollByUnit(fDirection);
    }

    if (fDirection > 0 && fScrollBar.getValue() + fScrollBar.getVisibleAmount() >= fScrollBar.getMaximum()) {
        ((Timer)e.getSource()).stop();
    } else if (fDirection < 0 && fScrollBar.getValue() <= fScrollBar.getMinimum()) {
        ((Timer)e.getSource()).stop();
    }
}
项目:komodoGUI    文件WalletTabPanel.java   
public WalletTabPanel()
    throws IOException,InterruptedException,WalletCallException
{       
    super();

    this.timers = new ArrayList<Timer>();
    this.threads = new ArrayList<DataGatheringThread<?>>();
}
项目:openjdk-jdk10    文件Test6559154.java   
public void run() {
    Timer timer = new Timer(1000,this);
    timer.setRepeats(false);
    timer.start();

    JColorChooser chooser = new JColorChooser();
    setEnabledRecursive(chooser,false);

    this.dialog = new jdialog();
    this.dialog.add(chooser);
    this.dialog.setVisible(true);
}
项目:Openjsharp    文件AquaScrollBarUI.java   
public void actionPerformed(final ActionEvent e) {
    if (fUseBlockIncrement) {
        Hit newPart = getPartHit(fTrackListener.fCurrentMouseX,fTrackListener.fCurrentMouseY);

        if (newPart == ScrollBarHit.THUMB) {
            ((Timer)e.getSource()).stop();
        }
    } else {
        scrollByUnit(fDirection);
    }

    if (fDirection > 0 && fScrollBar.getValue() + fScrollBar.getVisibleAmount() >= fScrollBar.getMaximum()) {
        ((Timer)e.getSource()).stop();
    } else if (fDirection < 0 && fScrollBar.getValue() <= fScrollBar.getMinimum()) {
        ((Timer)e.getSource()).stop();
    }
}
项目:incubator-netbeans    文件TTVTest.java   
private void cleanAndCheckTTV () {
    // make nodes and props gc'able
    replaceTTVContent();
    nodeStructure = null;
    props = null;
    // assure that weak hash map cache in TreeViewCell is busy a bit,// so that it really releases refs to its values
    repaintTimer = new Timer(1000,new ActionListener () {
        public void actionPerformed (ActionEvent evt) {
            if (repaintCount < 10) {
                ep.invalidate();
                ep.validate();
                ep.repaint();
                repaintCount++;
                // test if nodes were released correctly
                // invokelater so that it comes really after explorer
                // panel repaint
                SwingUtilities.invokelater(new Runnable() {
                    public void run() {
                        System.gc();
                        repaintTimer.stop();
                        result = repaintCount;
                        // wake up testNodeReleasing method,so that it can finish properly
                        synchronized (TTVTest.this) {
                            TTVTest.this.notifyAll();
                        }
                    }
                });
            } else {
                repaintTimer.stop();
                result = -1;
                // wake up testNodeReleasing method,so that it can finish properly
                synchronized (TTVTest.this) {
                    TTVTest.this.notifyAll();
                }
            }
        }
    });
    repaintTimer.start();
}
项目:incubator-netbeans    文件TabControlButtonFactory.java   
private void startTimer() {
    Timer t = getTimer();
    if (t.isRunning()) {
        return;
    }
    repaint();
    t.setDelay(400);
    t.start();
}
项目:SER316-Munich    文件DigitalClock1.java   
public ClockLabel(String type) {
  this.type = type;
  setForeground(Color.red);

  if(type.equals("date"))
  {
    sdf = new SimpleDateFormat("  MMMM dd yyyy");
      setFont(new Font("PHOSPHATE",Font.PLAIN,18));
      setHorizontalAlignment(SwingConstants.LEFT);
  }
  else if(type.equals("time"))
  {
    sdf = new SimpleDateFormat("hh:mm:ss a");
      setFont(new Font("PHOSPHATE",40));
      setHorizontalAlignment(SwingConstants.CENTER);
  }
  else if(type.equals("day"))
  {
    sdf = new SimpleDateFormat("EEEE  ");
      setFont(new Font("PHOSPHATE",18));
      setHorizontalAlignment(SwingConstants.RIGHT);
  }
  else
  {
    sdf = new SimpleDateFormat();
  }

  Timer t = new Timer(1000,this);
  t.start();
}
项目:incubator-netbeans    文件SearchHistoryPanel.java   
public SearchHistoryPanel(SVNUrl repositoryUrl,File localRoot,SearchCriteriaPanel criteria) {
    this.repositoryUrl = repositoryUrl;
    this.roots = new File[] { localRoot };
    this.criteria = criteria;
    this.diffViewFactory = new SearchHistoryTopComponent.DiffResultsViewFactory();
    criteriaVisible = true;
    explorerManager = new ExplorerManager ();
    initComponents();
    initializefilter();
    filterTimer = new Timer(500,this);
    filterTimer.stop();
    aquaBackgroundWorkaround();
    setupComponents();
    refreshComponents(true);
}
项目:java-swing-template    文件Dashboard.java   
/**
 * Creates new form Dashboard
 */
public Dashboard() {
    initComponents();
    Dashboard.this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    initButtons();
    initBackground();
    Utilities.setwindowIcon(Dashboard.this);

    Timer t = new Timer(3000,new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (new File("updater.exe").exists()) {
                Thread th = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        Utilities.runShellCommand(Updator.COMMAND_UPDATECHECK);
                    }
                });
                th.start();
            } else {
                JOptionPane.showMessageDialog(Dashboard.this,"Your software version is not equipped with the automatic update funcationality.\nPlease install the latest software to get updater facility.\nThank you.","Outdated software",JOptionPane.informatION_MESSAGE);
            }
        }
    });
    t.setRepeats(false);
    t.start();
}
项目:incubator-netbeans    文件GuiRunLevel.java   
/** Method to initialize the main window.
*/
private void initializeMainWindow() {
    StartLog.logStart ("Main window initialization"); //NOI18N

    TimableEventQueue.initialize();

    // -----------------------------------------------------------------------------------------------------
    // 11. Initialization of main window
    Statusdisplayer.getDefault().setStatusText (NbBundle.getMessage (GuiRunLevel.class,"MSG_MainWindowInit"));

    // force to initialize timer
    // sometimes happened that the timer thread was initialized under
    // a TaskThreadGroup
    // such task never ends or,if killed,timer is over
    Timer timerInit = new Timer(0,new java.awt.event.ActionListener() {
          public @Override void actionPerformed(java.awt.event.ActionEvent ev) { }
    });
    timerInit.setRepeats(false);
    timerInit.start();
    Splash.getInstance().increment(10);
    StartLog.logProgress ("Timer initialized"); // NOI18N

// -----------------------------------------------------------------------------------------------------
// 14. Open main window
    Statusdisplayer.getDefault().setStatusText (NbBundle.getMessage (GuiRunLevel.class,"MSG_WindowShowInit"));

    // Starts GUI components to be created and shown on screen.
    // I.e. main window + current workspace components.



    // Access winsys from AWT thread only. In this case main thread wouldn't harm,just to be kosher.
    final WindowSystem windowSystem = Lookup.getDefault().lookup(WindowSystem.class);
    if (windowSystem != null) {
        windowsystem.init();
    }
    SwingUtilities.invokelater(new InitWinSys(windowSystem));
    StartLog.logEnd ("Main window initialization"); //NOI18N
}
项目:freecol    文件DeclarationPanel.java   
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent ae) {
    final String command = ae.getActionCommand();
    if (ANIMATION_STOPPED.equals(command)) {
        Timer t = new Timer(FINISH_DELAY,(x) -> {
                getGUI().removeFromCanvas(DeclarationPanel.this);
            });
        t.setRepeats(false);
        t.start();
    } else {
        super.actionPerformed(ae);
    }
}
项目:Star-Ride--RiverRaid    文件Shoot.java   
/**
 * Metodo encargado de generar el disparo proveniente del player
 */
public void disparar(){
    timerdisparo = new Timer(10,new ActionListener(){
        @Override
        public void actionPerformed(ActionEvent e) {

               shoot.setLocation(shoot.getX(),shoot.getY()-4);
               detenerdisparo();           
        }
    });  
    timerdisparo.start();         
}
项目:FreeCol    文件DeclarationPanel.java   
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent ae) {
    final String command = ae.getActionCommand();
    if (ANIMATION_STOPPED.equals(command)) {
        Timer t = new Timer(FINISH_DELAY,(x) -> {
                getGUI().removeFromCanvas(DeclarationPanel.this);
            });
        t.setRepeats(false);
        t.start();
    } else {
        super.actionPerformed(ae);
    }
}
项目:AWGW    文件GridPanel.java   
/**
 * Show a tool tip.
 *
 * @param tipText the tool tip text
 * @param pt      the pixel position over which to show the tip
 */
public void showTip(String tipText,Point pt) {
    if (getRootPane() == null)
        return;
    // draw in glass pane to appear on top of other components
    if (glasspane == null) {
        getRootPane().setGlasspane(glasspane = new JPanel());
        glasspane.setopaque(false);
        glasspane.setLayout(null); // will control layout manually
        glasspane.add(tip = new JToolTip());
        tipTimer = new Timer(TIP_DELAY,new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                glasspane.setVisible(false);
            }
        });
        tipTimer.setRepeats(false);
    }
    if (tipText == null)
        return;

    // set tip text to identify current origin of pannable view
    tip.setTipText(tipText);

    // position tip to appear at upper left corner of viewport
    tip.setLocation(SwingUtilities.convertPoint(this,pt,glasspane));
    tip.setSize(tip.getPreferredSize());

    // show glass pane (it contains tip)
    glasspane.setVisible(true);
    glasspane.repaint();

    // this timer will hide the glass pane after a short delay
    tipTimer.restart();
}
项目:incubator-netbeans    文件LineFilter.java   
public LineProcessorBridge(LineFilter lineProcessor,int delay) {
    super();

    if (delay == 0)
        this.timer = null;
    else {
        this.timer = new Timer(delay,this);
        timer.setRepeats(false);
    }
    this.lineProcessor = lineProcessor;
}
项目:scorekeeperfrontend    文件MyIpLabel.java   
public MyIpLabel()
{
    super("");
    setHorizontalAlignment(CENTER);
    actionPerformed(null);
    new Timer(3000,this).start();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。