本文整理匯總了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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
}
}
示例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();
}
}
示例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);
}
}
}