本文整理汇总了Java中javax.swing.SwingUtilities.processKeyBindings方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.processKeyBindings方法的具体用法?Java SwingUtilities.processKeyBindings怎么用?Java SwingUtilities.processKeyBindings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.processKeyBindings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMemoryRelease
import javax.swing.SwingUtilities; //导入方法依赖的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: sendEventToDelegate
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void sendEventToDelegate(final AWTEvent e) {
if (getDelegate() == null || !isShowing() || !isEnabled()) {
return;
}
synchronized (getDelegateLock()) {
AWTEvent delegateEvent = createDelegateEvent(e);
if (delegateEvent != null) {
AWTAccessor.getComponentAccessor()
.processEvent((Component) delegateEvent.getSource(),
delegateEvent);
if (delegateEvent instanceof KeyEvent) {
KeyEvent ke = (KeyEvent) delegateEvent;
SwingUtilities.processKeyBindings(ke);
}
}
}
}