当前位置: 首页>>代码示例>>Java>>正文


Java Timer.setInitialDelay方法代码示例

本文整理汇总了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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BalloonManager.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DragWindow.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DragWindow.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TextEditorSupport.java

示例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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:TumbleItem.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: 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

}
 
开发者ID:cookerlyk,项目名称:missile-defense,代码行数:8,代码来源:GamePane.java

示例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?
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:AquaScrollBarUI.java

示例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();
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:8,代码来源:TimerBasedAnimation.java

示例10: run

import javax.swing.Timer; //导入方法依赖的package包/类
public void run(){
		timer = new Timer(TIMERTICK, this);
		timer.setInitialDelay(0);
		timer.start();
//		System.out.println(fireDelay);
	}
 
开发者ID:cookerlyk,项目名称:missile-defense,代码行数:7,代码来源:Turret.java

示例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();
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:63,代码来源:TextualDocumentView.java

示例12: start

import javax.swing.Timer; //导入方法依赖的package包/类
private void start() {
	Timer timer = new Timer(1000, this);

	timer.setInitialDelay(0);
	timer.start();
}
 
开发者ID:AitorB,项目名称:POPBL_V,代码行数:7,代码来源:Time.java

示例13: iniciar

import javax.swing.Timer; //导入方法依赖的package包/类
private void iniciar() {
	Timer timer = new Timer(1000, this);

	timer.setInitialDelay(0);
	timer.start();
}
 
开发者ID:AitorB,项目名称:POPBL_V,代码行数:7,代码来源:Date.java


注:本文中的javax.swing.Timer.setInitialDelay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。