当前位置: 首页>>代码示例>>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;未经允许,请勿转载。