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


Java Timer.restart方法代碼示例

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


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

示例1: TtyrecSource

import javax.swing.Timer; //導入方法依賴的package包/類
/**
 * Creates the ttyrec source. This should be overriden in implementing
 * classes to take arguments that specify things like the file or
 * network address to read the bytestream from. This also creates some
 * default analyzers and decoders, but leaves them paused by default.
 */
public TtyrecSource() {
	super("Ttyrec Source");
	rec = new Ttyrec();
	bytestream = new ByteChunkList();
	backportAnalyze = null;
	backportDecode = null;
	analysisListeners = new HashSet<>();
	decodeListeners = new HashSet<>();
	readListeners = new HashSet<>();
	listenerTimer = new Timer(100, new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			firePendingEvents();
			}
			});
	listenerTimer.restart();
	// The analyzer must be created before the decoder.
	// The analyzer starts with the most obvious-to-reject format (GZIP),
	// then tries the other formats in turn.
	leadingEdgeAnalyze =
		new TtyrecAnalyzer(this, 1, TtyrecAnalyzer.InputFormat.GZIP);
	// The decoder starts by trying 24x80, expanding if necessary.
	leadingEdgeDecode = new TtyrecDecoder(this, 2, 24, 80);
	leadingEdgeAnalyze.start();
	leadingEdgeDecode.start();
	leadingEdgeDecode.setPriority(MIN_PRIORITY);
	nextSequenceNumber = 3;
}
 
開發者ID:Elronnd,項目名稱:ttyrec2video,代碼行數:34,代碼來源:TtyrecSource.java

示例2: showTip

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


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