當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。