本文整理了Java中javax.swing.Timer.setRepeats()
方法的一些代码示例,展示了Timer.setRepeats()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.setRepeats()
方法的具体详情如下:
包路径:javax.swing.Timer
类名称:Timer
方法名:setRepeats
暂无
代码示例来源:origin: JetBrains/ideavim
private CommandState() {
myMappingTimer = new Timer(DEFAULT_TIMEOUT_LENGTH, null);
myMappingTimer.setRepeats(false);
myStates.push(new State(Mode.COMMAND, SubMode.NONE, MappingMode.NORMAL));
myLastChangeRegister = VimPlugin.getRegister().getDefaultRegister();
}
代码示例来源:origin: org.netbeans.api/org-openide-util
/** Impl of HierarchyListener, starts init job with delay when component shown,
* stops listening to asociated component it isn't showing anymore,
* calls cancel if desirable.
* @param evt hierarchy event
*/
@Override
public void hierarchyChanged(HierarchyEvent evt) {
final boolean hierachyChanged = (evt.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0;
LOG.log(Level.FINE, "Hierarchy Changed {0}", hierachyChanged);
if (hierachyChanged) {
boolean isShowing = comp4Init.isShowing();
if (timer == null && isShowing) {
timer = new Timer(20, this);
timer.setRepeats(false);
timer.start();
LOG.log(Level.FINE, "Timer started for {0}", comp4Init);
} else if (!isShowing) {
comp4Init.removeHierarchyListener(this);
LOG.log(Level.FINE, "Not showing, cancling for {0}", comp4Init);
cancel();
}
}
}
代码示例来源:origin: stackoverflow.com
int delayTime = 2 * 1000;
javax.swing.Timer myTimer = new Timer(delayTime, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO: put in the code you want called in xxx mSecs.
}
});
myTimer.setRepeats(false);
myTimer.start();
代码示例来源:origin: stackoverflow.com
tabbedPane.addTab( "Searching", new RotatingIcon( new ImageIcon( "resources/images/progress-indeterminate.png" ), tabbedPane ),
new JLabel( new ImageIcon( "resources/images/rotatingIcon.gif" ) ) );
frame.getContentPane().add( tabbedPane );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.pack();
frame.setVisible( true );
private RotatingIcon( Icon icon, final JComponent component ) {
delegateIcon = icon;
rotatingTimer = new Timer( 100, new ActionListener() {
@Override
public void actionPerformed( ActionEvent e ) {
rotatingTimer.setRepeats( false );
rotatingTimer.start();
delegateIcon.paintIcon(c, g2, x, y);
g2.setTransform(original);
rotatingTimer.start();
代码示例来源:origin: stackoverflow.com
frame.add(createUI());
frame.pack();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
javax.swing.Timer timer = new javax.swing.Timer(3000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
timer.setRepeats(true);
timer.setCoalesce(true);
timer.start();
代码示例来源:origin: RaiMan/SikuliX2
public void setTimeout(int timeout){
Timer timer = new Timer(timeout, new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
command = null;
dismiss();
}
});
timer.setRepeats(false);
timer.start();
}
代码示例来源:origin: groovy/groovy-core
SwingTimerFullBinding(SourceBinding source, TargetBinding target, int interval, int duration) {
setSourceBinding(source);
setTargetBinding(target);
timer = new Timer(interval, this);
timer.setInitialDelay(0);
timer.setRepeats(true);
this.duration = duration;
}
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
timeDisplay=new JLabel("0");
frame.getContentPane().add(timeDisplay);
frame.pack();
frame.setVisible(true);
timer=new Timer(1000, this);
timer.setRepeats(false);
timer.start();
timeDisplay.setText(elapsed+" Milliseconds since start");
timer.setInitialDelay((int)(startTime+seconds*1000-now));
timer.start();
代码示例来源:origin: magefree/mage
public void gainLifeDisplay() {
if (faderGainLife == null && doGainFade) {
doGainFade = false;
faderGainLife = new Timer(50, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
gainX++;
int alpha = Math.max(250 - gainX, 200);
setCenterColor(new Color(2 * gainX, 210, 255, alpha));
repaint();
if (gainX >= 100) {
setCenterColor(new Color(200, 210, 0, 200));
gainX = 100;
if (faderGainLife != null) {
faderGainLife.stop();
faderGainLife.setRepeats(false);
faderGainLife.setDelay(50000);
}
}
}
});
gainX = 0;
faderGainLife.setInitialDelay(25);
faderGainLife.setRepeats(true);
faderGainLife.start();
}
}
代码示例来源:origin: org.netbeans.api/org-openide-util
clearIntrospector = new Timer(15000, doClear);
clearIntrospector.setRepeats(false);
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
label = new JLabel("Some text to delete in 5 seconds");
frame.add(label);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Timer t = new Timer(5000, new ActionListener() {
t.setRepeats(false);
t.start();
代码示例来源:origin: magefree/mage
public void loseLifeDisplay() {
if (faderLoseLife == null && doLoseFade) {
doLoseFade = false;
faderLoseLife = new Timer(50, new ActionListener() {
public void actionPerformed(ActionEvent ae) {
loseX++;
int alpha = Math.max(250 - loseX, 200);
setCenterColor(new Color(250 - loseX / 2, 130 + loseX, 0, alpha));
repaint();
if (loseX >= 100) {
setCenterColor(new Color(200, 210, 0, 200));
loseX = 100;
stopLifeDisplay();
if (faderLoseLife != null) {
faderLoseLife.stop();
faderLoseLife.setRepeats(false);
faderLoseLife.setDelay(50000);
}
}
}
});
loseX = 0;
faderLoseLife.setInitialDelay(25);
faderLoseLife.setRepeats(true);
faderLoseLife.start();
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Constructor.
*
* @param delay The delay between the last key press and when the document
* is parsed.
* @param textArea The text area whose document the parser will be
* parsing.
*/
ParserManager(int delay, RSyntaxTextArea textArea) {
this.textArea = textArea;
textArea.getDocument().addDocumentListener(this);
textArea.addPropertyChangeListener("document", this);
parsers = new ArrayList<Parser>(1); // Usually small
timer = new Timer(delay, this);
timer.setRepeats(false);
running = true;
}
代码示例来源:origin: stackoverflow.com
testFrame.add( new JScrollPane( textArea ), BorderLayout.CENTER );
Timer timer = new Timer( 1000, new ActionListener() {
@Override
public void actionPerformed( ActionEvent e ) {
timer.setRepeats( true );
timer.start();
JButton button = new JButton( "Click me" );
button.addActionListener( new ActionListener() {
testFrame.add( button, BorderLayout.SOUTH );
testFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
testFrame.pack();
testFrame.setVisible( true );
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
/** Impl of HierarchyListener, starts init job with delay when component shown,
* stops listening to asociated component it isn't showing anymore,
* calls cancel if desirable.
* @param evt hierarchy event
*/
@Override
public void hierarchyChanged(HierarchyEvent evt) {
final boolean hierachyChanged = (evt.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0;
LOG.log(Level.FINE, "Hierarchy Changed {0}", hierachyChanged);
if (hierachyChanged) {
boolean isShowing = comp4Init.isShowing();
if (timer == null && isShowing) {
timer = new Timer(20, this);
timer.setRepeats(false);
timer.start();
LOG.log(Level.FINE, "Timer started for {0}", comp4Init);
} else if (!isShowing) {
comp4Init.removeHierarchyListener(this);
LOG.log(Level.FINE, "Not showing, cancling for {0}", comp4Init);
cancel();
}
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Constructor.
*
* @param delay The delay between when the caret last moves and when the
* text should be scanned for matching occurrences. This should
* be in milliseconds.
* @param color The color to use to mark the occurrences. This cannot be
* <code>null</code>.
*/
MarkOccurrencesSupport(int delay, Color color) {
timer = new Timer(delay, this);
timer.setRepeats(false);
p = new SmartHighlightPainter();
setColor(color);
}
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(jsp);
frame.pack();
frame.setVisible(true);
Timer t = new Timer(2000, new AbstractAction() {//create timer to add JLabel to scrollPane after 2 seconds
@Override
public void actionPerformed(ActionEvent ae) {
final JLabel label3 = new JLabel("Noooooo reealllly");
final JLabel label4 = new JLabel("Yes");
labelPanel.add(label);
labelPanel.add(label2);
labelPanel.add(label3);
labelPanel.add(label4);
t.setRepeats(false);
t.start();
代码示例来源:origin: chatty/chatty
public IgnoredMessages(MainGui g) {
this.g = g;
Timer timer = new Timer(DELAY*1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
output();
}
});
timer.setRepeats(true);
timer.start();
}
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
clearIntrospector = new Timer(15000, doClear);
clearIntrospector.setRepeats(false);
代码示例来源:origin: stackoverflow.com
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.setLayout(new GridBagLayout());
((JComponent)frame.getContentPane()).setBorder(new EmptyBorder(20, 20, 20, 20));
frame.add(new JLabel("Boo"));
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Timer timer = new Timer(5000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
timer.setRepeats(false);
timer.start();
内容来源于网络,如有侵权,请联系作者删除!