當前位置: 首頁>>代碼示例>>Java>>正文


Java Timer.setRepeats方法代碼示例

本文整理匯總了Java中javax.swing.Timer.setRepeats方法的典型用法代碼示例。如果您正苦於以下問題:Java Timer.setRepeats方法的具體用法?Java Timer.setRepeats怎麽用?Java Timer.setRepeats使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.Timer的用法示例。


在下文中一共展示了Timer.setRepeats方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: MemoryView

import javax.swing.Timer; //導入方法依賴的package包/類
/**
 * 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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:MemoryView.java

示例2: SearchHistoryPanel

import javax.swing.Timer; //導入方法依賴的package包/類
/** Creates new form SearchHistoryPanel */
public SearchHistoryPanel(File repository, RepositoryInfo info, File [] roots, SearchCriteriaPanel criteria) {
    this.roots = roots;
    this.repository = repository;
    this.info = info;
    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();
    setupComponents();
    info.addPropertyChangeListener(list = WeakListeners.propertyChange(this, info));
    aquaBackgroundWorkaround();
    refreshComponents(true);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:SearchHistoryPanel.java

示例3: invokeTip

import javax.swing.Timer; //導入方法依賴的package包/類
/** 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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:TooltipHack.java

示例4: SearchHistoryPanel

import javax.swing.Timer; //導入方法依賴的package包/類
/** 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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:SearchHistoryPanel.java

示例5: disableSelection

import javax.swing.Timer; //導入方法依賴的package包/類
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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:GraphPanel.java

示例6: enableBlinkEffect

import javax.swing.Timer; //導入方法依賴的package包/類
/**
 * Enables the blink effect.
 *
 * @param millsBetweenBlinks
 *         The amount of time, in milliseconds, before the blink effect can occur.
 *
 * @param radio
 *         The Radio to transmit a DRAW event to whenever a blink occurs.
 */
public void enableBlinkEffect(final short millsBetweenBlinks, final Radio<String> radio) {
    if (radio == null) {
        throw new NullPointerException("You must specify a Radio when enabling a blink effect.");
    }

    if (millsBetweenBlinks <= 0) {
        this.millsBetweenBlinks = 1000;
    } else {
        this.millsBetweenBlinks = millsBetweenBlinks;
    }

    blinkTimer = new Timer(this.millsBetweenBlinks, e -> {
        isHidden = !isHidden;
        radio.transmit("DRAW");
    });
    blinkTimer.setInitialDelay(this.millsBetweenBlinks);
    blinkTimer.setRepeats(true);
    blinkTimer.start();
}
 
開發者ID:Valkryst,項目名稱:VTerminal,代碼行數:29,代碼來源:AsciiCharacter.java

示例7: doInBackground

import javax.swing.Timer; //導入方法依賴的package包/類
@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<>();
    }
}
 
開發者ID:chipKIT32,項目名稱:chipKIT-importer,代碼行數:22,代碼來源:ImportWorker.java

示例8: setupProgress

import javax.swing.Timer; //導入方法依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ProgressLabel.java

示例9: AnnotationSetsView

import javax.swing.Timer; //導入方法依賴的package包/類
public AnnotationSetsView(){
  setHandlers = new ArrayList<SetHandler>();
  tableRows = new ArrayList<Object>();
  visibleAnnotationTypes = new LinkedBlockingQueue<TypeSpec>();
  pendingEvents = new LinkedBlockingQueue<GateEvent>();
  eventMinder = new Timer(EVENTS_HANDLE_DELAY, 
          new HandleDocumentEventsAction());
  eventMinder.setRepeats(true);
  eventMinder.setCoalesce(true);    
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:11,代碼來源:AnnotationSetsView.java

示例10: Timer

import javax.swing.Timer; //導入方法依賴的package包/類
/** 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);
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:ToolTipSupport.java

示例11: DeclarationPanel

import javax.swing.Timer; //導入方法依賴的package包/類
/**
 * Creates a DeclarationPanel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public DeclarationPanel(FreeColClient freeColClient) {
    super(freeColClient, null);

    Image image = ResourceManager.getImage("image.flavor.Declaration");
    setSize(image.getWidth(null), image.getHeight(null));
    setOpaque(false);
    setBorder(null);
    addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent k) {
                getGUI().removeFromCanvas(DeclarationPanel.this);
            }
        });
    addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                getGUI().removeFromCanvas(DeclarationPanel.this);
            }
        });

    final SignaturePanel signaturePanel = new SignaturePanel();
    signaturePanel.initialize(getMyPlayer().getName());
    signaturePanel.setLocation((getWidth()-signaturePanel.getWidth()) / 2,
        (getHeight() + SIGNATURE_Y - signaturePanel.getHeight()) / 2 - 15);
    signaturePanel.addActionListener(this);

    add(signaturePanel);

    Timer t = new Timer(START_DELAY, (ActionEvent ae) -> {
            signaturePanel.startAnimation();
        });
    t.setRepeats(false);
    t.start();
}
 
開發者ID:wintertime,項目名稱:FreeCol,代碼行數:40,代碼來源:DeclarationPanel.java

示例12: runTest

import javax.swing.Timer; //導入方法依賴的package包/類
public static synchronized void runTest() {
    frame.setSize(800, 600);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Timer timer = new Timer(waitTime, new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            frame.setExtendedState(Frame.ICONIFIED);
            frame.dispose();
            Sysout.println("Test completed please press/fail button");
        }
    });
    timer.setRepeats(false);
    timer.start();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:bug8037575.java

示例13: DelayedDocumentChangeListener

import javax.swing.Timer; //導入方法依賴的package包/類
@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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:DelayedDocumentChangeListener.java

示例14: SwingController

import javax.swing.Timer; //導入方法依賴的package包/類
public SwingController(ProgressUIWorker comp) {
    super(comp);
    timer = new Timer(TIMER_QUANTUM, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            runNow();
        }
    });
    timer.setRepeats(false);
    runCompatInit(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SwingController.java

示例15: ProfilerStatus

import javax.swing.Timer; //導入方法依賴的package包/類
private ProfilerStatus(ProfilerSession session) {
    this.session = session;
    
    refreshTimer = new Timer(STATUS_REFRESH, new ActionListener() {
        public void actionPerformed(ActionEvent e) { updateStatus(); }
    });
    refreshTimer.setRepeats(false);
    
    session.addListener(new SimpleProfilingStateAdapter() {
        public void update() { updateStatus(); }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:ProfilerStatus.java


注:本文中的javax.swing.Timer.setRepeats方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。