當前位置: 首頁>>代碼示例>>Java>>正文


Java EventQueue.getMostRecentEventTime方法代碼示例

本文整理匯總了Java中java.awt.EventQueue.getMostRecentEventTime方法的典型用法代碼示例。如果您正苦於以下問題:Java EventQueue.getMostRecentEventTime方法的具體用法?Java EventQueue.getMostRecentEventTime怎麽用?Java EventQueue.getMostRecentEventTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.EventQueue的用法示例。


在下文中一共展示了EventQueue.getMostRecentEventTime方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testMemoryRelease

import java.awt.EventQueue; //導入方法依賴的package包/類
@RandomlyFails
public void testMemoryRelease() throws Exception { // Issue #147984
    org.netbeans.junit.Log.enableInstances(Logger.getLogger("TIMER"), "CodeTemplateInsertHandler", Level.FINEST);

    JEditorPane pane = new JEditorPane();
    NbEditorKit kit = new NbEditorKit();
    pane.setEditorKit(kit);
    Document doc = pane.getDocument();
    assertTrue(doc instanceof BaseDocument);
    CodeTemplateManager mgr = CodeTemplateManager.get(doc);
    String templateText = "Test with parm ";
    CodeTemplate ct = mgr.createTemporary(templateText + " ${a}");
    ct.insert(pane);
    assertEquals(templateText + " a", doc.getText(0, doc.getLength()));

    // Send Enter to stop editing
    KeyEvent enterKeyEvent = new KeyEvent(pane, KeyEvent.KEY_PRESSED,
            EventQueue.getMostRecentEventTime(),
            0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED);

    SwingUtilities.processKeyBindings(enterKeyEvent);
    // CT editing should be finished

    org.netbeans.junit.Log.assertInstances("CodeTemplateInsertHandler instances not GCed");
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:CodeTemplatesTest.java

示例2: postToolTip

import java.awt.EventQueue; //導入方法依賴的package包/類
public static void postToolTip(JComponent comp) {
	Action action = comp.getActionMap().get("postTip");
	if (action == null) {
		return;
	}
	ActionEvent ae = new ActionEvent(comp, ActionEvent.ACTION_PERFORMED, "postTip", EventQueue.getMostRecentEventTime(),
			0);
	action.actionPerformed(ae);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:10,代碼來源:ExtendedJSliderToolTips.java

示例3: hideToolTip

import java.awt.EventQueue; //導入方法依賴的package包/類
public static void hideToolTip(JComponent comp) {
	Action action = comp.getActionMap().get("hideTip");
	if (action == null) {
		return;
	}
	ActionEvent ae = new ActionEvent(comp, ActionEvent.ACTION_PERFORMED, "hideTip", EventQueue.getMostRecentEventTime(),
			0);
	action.actionPerformed(ae);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:10,代碼來源:ExtendedJSliderToolTips.java

示例4: postToolTip

import java.awt.EventQueue; //導入方法依賴的package包/類
public static void postToolTip(JComponent comp){ 
    Action action = comp.getActionMap().get("postTip"); 
    if(action==null) // no tooltip 
        return; 
    ActionEvent ae = new ActionEvent(comp, ActionEvent.ACTION_PERFORMED, 
                            "postTip", EventQueue.getMostRecentEventTime(), 0); 
    action.actionPerformed(ae); 
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:9,代碼來源:SliderToolTips.java

示例5: hideToolTip

import java.awt.EventQueue; //導入方法依賴的package包/類
public static void hideToolTip(JComponent comp){ 
    Action action = comp.getActionMap().get("hideTip"); 
    if(action==null) // no tooltip 
        return; 
    ActionEvent ae = new ActionEvent(comp, ActionEvent.ACTION_PERFORMED, 
                            "hideTip", EventQueue.getMostRecentEventTime(), 0); 
    action.actionPerformed(ae); 
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:9,代碼來源:SliderToolTips.java

示例6: readObject

import java.awt.EventQueue; //導入方法依賴的package包/類
/**
 * Initializes the <code>when</code> field if it is not present in the
 * object input stream. In that case, the field will be initialized by
 * invoking {@link java.awt.EventQueue#getMostRecentEventTime()}.
 */
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
    s.defaultReadObject();
    if (when == 0) {
        // Can't use getMostRecentEventTimeForSource because source is always null during deserialization
        when = EventQueue.getMostRecentEventTime();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:InputMethodEvent.java

示例7: fireActionPerformed

import java.awt.EventQueue; //導入方法依賴的package包/類
/**
 * Notifies all listeners that have registered interest for
 * notification on this event type. The event instance
 * is lazily created using the <code>command</code> parameter.
 *
 * @see EventListenerList
 */
protected void fireActionPerformed(String command) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    long mostRecentEventTime = EventQueue.getMostRecentEventTime();
    int modifiers = 0;
    AWTEvent currentEvent = EventQueue.getCurrentEvent();
    if (currentEvent instanceof InputEvent) {
        modifiers = ((InputEvent)currentEvent).getModifiers();
    } else if (currentEvent instanceof ActionEvent) {
        modifiers = ((ActionEvent)currentEvent).getModifiers();
    }
    ActionEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==ActionListener.class) {
            // Lazily create the event:
            if (e == null) {
                e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
                                    command, mostRecentEventTime,
                                    modifiers);
            }
            ((ActionListener)listeners[i+1]).actionPerformed(e);
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:34,代碼來源:JFileChooser.java

示例8: readObject

import java.awt.EventQueue; //導入方法依賴的package包/類
/**
 * Initializes the {@code when} field if it is not present in the
 * object input stream. In that case, the field will be initialized by
 * invoking {@link java.awt.EventQueue#getMostRecentEventTime()}.
 */
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
    s.defaultReadObject();
    if (when == 0) {
        // Can't use getMostRecentEventTimeForSource because source is always null during deserialization
        when = EventQueue.getMostRecentEventTime();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:InputMethodEvent.java

示例9: fireActionPerformed

import java.awt.EventQueue; //導入方法依賴的package包/類
/**
 * Notifies all listeners that have registered interest for
 * notification on this event type. The event instance
 * is lazily created using the <code>command</code> parameter.
 *
 * @param command a string that may specify a command associated with
 *                the event
 * @see EventListenerList
 */
@SuppressWarnings("deprecation")
protected void fireActionPerformed(String command) {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    long mostRecentEventTime = EventQueue.getMostRecentEventTime();
    int modifiers = 0;
    AWTEvent currentEvent = EventQueue.getCurrentEvent();
    if (currentEvent instanceof InputEvent) {
        modifiers = ((InputEvent)currentEvent).getModifiers();
    } else if (currentEvent instanceof ActionEvent) {
        modifiers = ((ActionEvent)currentEvent).getModifiers();
    }
    ActionEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==ActionListener.class) {
            // Lazily create the event:
            if (e == null) {
                e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
                                    command, mostRecentEventTime,
                                    modifiers);
            }
            ((ActionListener)listeners[i+1]).actionPerformed(e);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:37,代碼來源:JFileChooser.java


注:本文中的java.awt.EventQueue.getMostRecentEventTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。