本文整理汇总了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);
}
}
}