本文整理汇总了Java中javax.swing.Timer.setInitialDelay方法的典型用法代码示例。如果您正苦于以下问题:Java Timer.setInitialDelay方法的具体用法?Java Timer.setInitialDelay怎么用?Java Timer.setInitialDelay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Timer
的用法示例。
在下文中一共展示了Timer.setInitialDelay方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startDismissTimer
import javax.swing.Timer; //导入方法依赖的package包/类
synchronized void startDismissTimer (int timeout) {
stopDismissTimer();
currentAlpha = 1.0f;
dismissTimer = new Timer(DISMISS_REPAINT_REPEAT, new ActionListener() {
public void actionPerformed(ActionEvent e) {
currentAlpha -= ALPHA_DECREMENT;
if( currentAlpha <= ALPHA_DECREMENT ) {
stopDismissTimer();
dismiss();
}
repaint();
}
});
dismissTimer.setInitialDelay (timeout);
dismissTimer.start();
}
示例2: createInitialEffect
import javax.swing.Timer; //导入方法依赖的package包/类
private Timer createInitialEffect() {
final Timer timer = new Timer(100, null);
timer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if( contentAlpha < 1.0f ) {
contentAlpha += ALPHA_INCREMENT;
} else {
timer.stop();
}
if( contentAlpha > 1.0f )
contentAlpha = 1.0f;
repaintImageBuffer();
repaint();
}
});
timer.setInitialDelay(0);
return timer;
}
示例3: createNoDropEffect
import javax.swing.Timer; //导入方法依赖的package包/类
private Timer createNoDropEffect() {
final Timer timer = new Timer(100, null);
timer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if( contentAlpha > NO_DROP_ALPHA ) {
contentAlpha -= ALPHA_INCREMENT;
} else {
timer.stop();
}
if( contentAlpha < NO_DROP_ALPHA )
contentAlpha = NO_DROP_ALPHA;
repaintImageBuffer();
repaint();
}
});
timer.setInitialDelay(0);
return timer;
}
示例4: initTimer
import javax.swing.Timer; //导入方法依赖的package包/类
/**
* Initialize timers and handle their ticks.
*/
private void initTimer() {
timer = new Timer(0, new java.awt.event.ActionListener() {
// we are called from the AWT thread so put itno other one
public void actionPerformed(java.awt.event.ActionEvent e) {
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug("$$ TextEditorSupport::initTimer::actionPerformed: event = " + e);
RequestProcessor.postRequest( new Runnable() {
public void run() {
syncDocument(false);
}
});
}
});
timer.setInitialDelay(getAutoParsingDelay());
timer.setRepeats(false);
}
示例5: init
import javax.swing.Timer; //导入方法依赖的package包/类
public void init() {
loadAppletParameters();
// Execute a job on the event-dispatching thread:
// creating this applet's GUI.
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createGUI();
}
});
} catch (Exception e) {
System.err.println("createGUI didn't successfully complete");
}
// Set up timer to drive animation events.
timer = new Timer(speed, this);
timer.setInitialDelay(pause);
timer.start();
// Start loading the images in the background.
worker.execute();
}
示例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();
}
示例7: run
import javax.swing.Timer; //导入方法依赖的package包/类
public void run(){
move = new Timer(this.gameSpeed, (ActionListener) this);
move.setInitialDelay(INITIAL_DELAY);
move.start();
this.lvl.startRound(); // starts the round timer
}
示例8: installListeners
import javax.swing.Timer; //导入方法依赖的package包/类
protected void installListeners() {
fTrackListener = createTrackListener();
fModelListener = createModelListener();
fPropertyChangeListener = createPropertyChangeListener();
fScrollBar.addMouseListener(fTrackListener);
fScrollBar.addMouseMotionListener(fTrackListener);
fScrollBar.getModel().addChangeListener(fModelListener);
fScrollBar.addPropertyChangeListener(fPropertyChangeListener);
fScrollListener = createScrollListener();
fScrollTimer = new Timer(kNormalDelay, fScrollListener);
fScrollTimer.setInitialDelay(kInitialDelay); // default InitialDelay?
}
示例9: TimerBasedAnimation
import javax.swing.Timer; //导入方法依赖的package包/类
public TimerBasedAnimation() {
setXY(20 * Math.random(), 200, 200);
timer = new Timer(20, this);
timer.setInitialDelay(190);
timer.start();
}
示例10: run
import javax.swing.Timer; //导入方法依赖的package包/类
public void run(){
timer = new Timer(TIMERTICK, this);
timer.setInitialDelay(0);
timer.start();
// System.out.println(fireDelay);
}
示例11: initGUI
import javax.swing.Timer; //导入方法依赖的package包/类
@Override
protected void initGUI() {
// textView = new JEditorPane();
// textView.setContentType("text/plain");
// textView.setEditorKit(new RawEditorKit());
textView = new JTextArea();
textView.setAutoscrolls(false);
textView.setLineWrap(true);
textView.setWrapStyleWord(true);
// the selection is hidden when the focus is lost for some system
// like Linux, so we make sure it stays
// it is needed when doing a selection in the search textfield
textView.setCaret(new PermanentSelectionCaret());
scroller = new JScrollPane(textView);
textView.setText(document.getContent().toString());
textView.getDocument().addDocumentListener(swingDocListener);
// display and put the caret at the beginning of the file
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
if(textView.modelToView(0) != null) {
textView.scrollRectToVisible(textView.modelToView(0));
}
textView.select(0, 0);
textView.requestFocus();
} catch(BadLocationException e) {
e.printStackTrace();
}
}
});
// contentPane = new JPanel(new BorderLayout());
// contentPane.add(scroller, BorderLayout.CENTER);
// //get a pointer to the annotation list view used to display
// //the highlighted annotations
// Iterator horizViewsIter = owner.getHorizontalViews().iterator();
// while(annotationListView == null && horizViewsIter.hasNext()){
// DocumentView aView = (DocumentView)horizViewsIter.next();
// if(aView instanceof AnnotationListView)
// annotationListView = (AnnotationListView)aView;
// }
highlightsMinder = new Timer(BLINK_DELAY, new UpdateHighlightsAction());
highlightsMinder.setInitialDelay(HIGHLIGHT_DELAY);
highlightsMinder.setDelay(BLINK_DELAY);
highlightsMinder.setRepeats(true);
highlightsMinder.setCoalesce(true);
highlightsMinder.start();
// blinker = new Timer(this.getClass().getCanonicalName() +
// "_blink_timer",
// true);
// final BlinkAction blinkAction = new BlinkAction();
// blinker.scheduleAtFixedRate(new TimerTask(){
// public void run() {
// blinkAction.actionPerformed(null);
// }
// }, 0, BLINK_DELAY);
initListeners();
}
示例12: start
import javax.swing.Timer; //导入方法依赖的package包/类
private void start() {
Timer timer = new Timer(1000, this);
timer.setInitialDelay(0);
timer.start();
}
示例13: iniciar
import javax.swing.Timer; //导入方法依赖的package包/类
private void iniciar() {
Timer timer = new Timer(1000, this);
timer.setInitialDelay(0);
timer.start();
}