Java Code Examples for javax.swing.Timer#setRepeats()
The following examples show how to use
javax.swing.Timer#setRepeats() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataToolTab.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Initializes this panel. */ private void init() { if(isInitialized) { return; } splitPanes[1].setDividerLocation(1.0); propsAndStatsAction.actionPerformed(null); // kludge: do propsAndStatsAction again after a few milliseconds! Timer timer = new Timer(5, new ActionListener() { public void actionPerformed(ActionEvent e) { propsAndStatsAction.actionPerformed(null); } }); timer.setRepeats(false); timer.start(); for(int i = 0; i<dataTable.getColumnCount(); i++) { String colName = dataTable.getColumnName(i); dataTable.getWorkingData(colName); } refreshPlot(); refreshGUI(); isInitialized = true; }
Example 2
Source File: WorldGenerationBencher.java From amidst with GNU General Public License v3.0 | 6 votes |
private void launchMainWindow(Application app, RunningLauncherProfile profile) { MainWindow window = app.displayMainWindow(profile); window.getWorldSwitcher().displayWorld(WORLD_OPTIONS); for(int i = 0; i < 10; i++) { window.getViewerFacade().adjustZoom(1); } window.getViewerFacade().centerOn(CoordinatesInWorld.origin()); Timer timer = new Timer(1000, e -> {}); timer.setRepeats(true); timer.setInitialDelay(1000); timer.addActionListener(e -> { if(window.getViewerFacade().isFullyLoaded()) { timer.stop(); fullyLoadedBarrier.release(); } }); timer.start(); }
Example 3
Source File: RPToast.java From RipplePower with Apache License 2.0 | 6 votes |
public void fadeOut() { final Timer timer = new Timer(FADE_REFRESH_RATE, null); timer.setRepeats(true); timer.addActionListener(new ActionListener() { private float opacity = MAX_OPACITY; @Override public void actionPerformed(ActionEvent e) { opacity -= OPACITY_INCREMENT; setOpacity(Math.max(opacity, 0)); if (opacity <= 0) { timer.stop(); setVisible(false); dispose(); } } }); setOpacity(MAX_OPACITY); timer.start(); }
Example 4
Source File: StaffApplication.java From RemoteSupportTool with Apache License 2.0 | 6 votes |
@Override public void start() { monitoringTimer = new Timer(1000, e -> { if (uploadMonitor == null || downloadMonitor == null) return; try { frame.setRates(downloadMonitor.getAverageRate(), uploadMonitor.getAverageRate()); Date minAge = new Date(System.currentTimeMillis() - 2000); downloadMonitor.removeOldSamples(minAge); uploadMonitor.removeOldSamples(minAge); } catch (Exception ex) { LOGGER.warn("Can't upload monitoring!", ex); } }); monitoringTimer.setRepeats(true); monitoringTimer.start(); super.start(); }
Example 5
Source File: TooltipHack.java From netbeans with Apache License 2.0 | 6 votes |
/** 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(), 0, x, y, 0, false); ttm.mouseMoved(fakeEvt); ttm.setInitialDelay(prevInit); Timer timer = new Timer(20, instance()); timer.setRepeats(false); timer.start(); }
Example 6
Source File: SwingUtils.java From RipplePower with Apache License 2.0 | 6 votes |
public static void fadeIn(final Dialog win) { if (!win.isUndecorated()) { return; } final Timer timer = new Timer(30, null); timer.setRepeats(true); timer.addActionListener(new ActionListener() { private float opacity = 0; @Override public void actionPerformed(ActionEvent e) { opacity += 0.05f; win.setOpacity(Math.min(opacity, 1f)); if (opacity >= 1) { timer.stop(); } } }); win.setOpacity(0); timer.start(); win.setVisible(true); }
Example 7
Source File: LoadingDisplay.java From minicraft-plus-revived with GNU General Public License v3.0 | 5 votes |
public LoadingDisplay() { super(true, false); t = new Timer(500, e -> { World.initWorld(); Game.setMenu(null); }); t.setRepeats(false); }
Example 8
Source File: DelayedDocumentChangeListener.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@SuppressWarnings("LeakingThisInConstructor") private DelayedDocumentChangeListener(Document doc, final ChangeListener l, int delay) { this.doc = doc; this.doc.addDocumentListener(this); this.chEvt = new ChangeEvent(doc); changeTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { l.stateChanged(chEvt); } }); changeTimer.setRepeats(false); }
Example 9
Source File: SessionBean.java From tn5250j with GNU General Public License v2.0 | 5 votes |
private void doVisibility() { if (!isVisible() && (visibilityInterval > 0)) { Timer t = new Timer(visibilityInterval, new DoVisible()); t.setRepeats(false); t.start(); } else if (!isVisible()) { new DoVisible().run(); } }
Example 10
Source File: Player.java From jclic with GNU General Public License v2.0 | 5 votes |
/** * Creates and initializes the members {@link timer}, {@link delayedTimer} and * {@link delayedAction} */ protected void initTimers() { timer = new Timer(1000, this); delayedTimer = new Timer(1000, this); delayedTimer.setRepeats(false); delayedAction = null; }
Example 11
Source File: Test6559154.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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); }
Example 12
Source File: GuiSelectionListener.java From niftyeditor with Apache License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if(enable){ e.getComponent().requestFocusInWindow(); toServe = e; hold = new Timer(225, this); hold.setRepeats(false); hold.start(); } if(e.isPopupTrigger()){ this.p.show(e.getComponent(), e.getX(), e.getY()); } }
Example 13
Source File: SelectUriStep.java From netbeans with Apache License 2.0 | 5 votes |
public SelectUriStep (File repositoryFile, Map<String, GitRemoteConfig> remotes, Mode mode) { this.repositoryFile = repositoryFile; this.repository = new RemoteRepository(null); this.panel = new SelectUriPanel(repository.getPanel()); this.remotes = remotes; this.inputFields = new JComponent[] { panel.cmbConfiguredRepositories, panel.rbConfiguredUri, panel.rbCreateNew, panel.lblRemoteNames, panel.cbPersistRemote, panel.cmbRemoteNames }; this.mode = mode; remoteNameEditTimer = new Timer(300, this); remoteNameEditTimer.setRepeats(false); remoteNameEditTimer.stop(); fillPanel(); attachListeners(); Mutex.EVENT.readAccess(new Runnable() { @Override public void run () { enableFields(); validateBeforeNext(); } }); }
Example 14
Source File: ServerAdminAPI.java From chipster with MIT License | 5 votes |
public void query() throws JMSException, InterruptedException { mutex.lock(); try { statuses = new ArrayList<ServerStatusMessage>(); CommandMessage request = new CommandMessage(CommandMessage.COMMAND_GET_COMP_STATUS); getTopic().sendReplyableMessage(request, this); } finally { mutex.unlock(); } // clean up the topic simply after a fixed delay, because // we don't know when all the serves have replied Timer cleanUpTimer = new Timer(cleanUpDelay * 1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mutex.lock(); try { cleanUp(); } finally { mutex.unlock(); } } }); cleanUpTimer.setRepeats(false); cleanUpTimer.start(); }
Example 15
Source File: AnimationIcon.java From RipplePower with Apache License 2.0 | 5 votes |
public AnimationIcon(Icon icon, final JComponent component, final boolean repeat) { delegateIcon = icon; width = delegateIcon.getIconWidth(); height = delegateIcon.getIconHeight(); timer = new Timer(100, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { incrementRotation(component); } }); LSystem.invokeLater(new Runnable() { @Override public void run() { component.repaint(); } }); timer.setRepeats(repeat); timer.start(); }
Example 16
Source File: Test6559154.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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); }
Example 17
Source File: DataToolTab.java From osp with GNU General Public License v3.0 | 4 votes |
/** * Sets the font level. * * @param level the level */ protected void setFontLevel(int level) { FontSizer.setFonts(this, level); plot.setFontLevel(level); FontSizer.setFonts(statsTable, level); FontSizer.setFonts(propsTable, level); curveFitter.setFontLevel(level); double factor = FontSizer.getFactor(level); plot.getAxes().resizeFonts(factor, plot); FontSizer.setFonts(plot.getPopupMenu(), level); if(propsTable.styleDialog!=null) { FontSizer.setFonts(propsTable.styleDialog, level); propsTable.styleDialog.pack(); } if(dataBuilder!=null) { dataBuilder.setFontLevel(level); } fitterAction.actionPerformed(null); propsTable.refreshTable(); // set shift field and label fonts in case they are not currently displayed FontSizer.setFonts(shiftXLabel, level); FontSizer.setFonts(shiftYLabel, level); FontSizer.setFonts(selectedXLabel, level); FontSizer.setFonts(selectedYLabel, level); FontSizer.setFonts(shiftXField, level); FontSizer.setFonts(shiftYField, level); FontSizer.setFonts(selectedXField, level); FontSizer.setFonts(selectedYField, level); shiftXField.refreshPreferredWidth(); shiftYField.refreshPreferredWidth(); selectedXField.refreshPreferredWidth(); selectedYField.refreshPreferredWidth(); toolbar.revalidate(); refreshStatusBar(null); // kludge to display tables correctly: do propsAndStatsAction now and again after a millisecond! propsAndStatsAction.actionPerformed(null); Timer timer = new Timer(1, new ActionListener() { public void actionPerformed(ActionEvent e) { propsAndStatsAction.actionPerformed(null); } }); timer.setRepeats(false); timer.start(); }
Example 18
Source File: SlideGestureRecognizer.java From netbeans with Apache License 2.0 | 4 votes |
AutoSlideTrigger() { super(); slideInTimer = new Timer(200, this); slideInTimer.setRepeats(true); slideInTimer.setCoalesce(true); }
Example 19
Source File: AbstractPatchedTransferHandler.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
public AbstractPatchedTransferHandler() { hideTimer = new Timer(HIDE_DELAY, new hidePopupAction()); hideTimer.setRepeats(false); showTimer = new Timer(SHOW_DELAY, new showPopupAction()); showTimer.setRepeats(false); }
Example 20
Source File: SwingBugUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Runs the supplied class after a certain period of time, the thread * will be executed in the EDT. * * @param execute The runnable object whose method will be called after the * specified delay * @param after The delay in ms before the event will be called */ public static void invokeAfter(final Runnable execute, int after){ Timer timer = new Timer(after, (ActionEvent actionEvent) -> execute.run()); timer.setRepeats(false); timer.start(); }