当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.processKeyBindings方法代码示例

本文整理汇总了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");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:CodeTemplatesTest.java

示例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);
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LWComponentPeer.java


注:本文中的javax.swing.SwingUtilities.processKeyBindings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。