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