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


Java TextUI.getEditorKit方法代碼示例

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


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

示例1: actionPerformed

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent evt) {
    // Find the right action for the corresponding editor kit
    JTextComponent component = getTextComponent(evt);
    if (component != null) {
        TextUI ui = component.getUI();
        if (ui != null) {
            EditorKit kit = ui.getEditorKit(component);
            if (kit != null) {
                Action action = EditorUtilities.getAction(kit, actionName);
                if (action != null) {
                    action.actionPerformed(evt);
                } else {
                    if (LOG.isLoggable(Level.FINE)) {
                        LOG.fine("Action '" + actionName + "' not found in editor kit " + kit + '\n'); // NOI18N
                    }
                }
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:PresenterEditorAction.java

示例2: findEditorKeys

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
/** Attempt to find the editor keystroke for the given editor action. */
private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) {
    // This method is implemented due to the issue
    // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action
    KeyStroke[] ret = new KeyStroke[] { defaultKey };
    if (component != null) {
        TextUI componentUI = component.getUI();
        Keymap km = component.getKeymap();
        if (componentUI != null && km != null) {
            EditorKit kit = componentUI.getEditorKit(component);
            if (kit instanceof BaseKit) {
                 Action a = ((BaseKit)kit).getActionByName(editorActionName);
                if (a != null) {
                    KeyStroke[] keys = km.getKeyStrokesForAction(a);
                    if (keys != null && keys.length > 0) {
                        ret = keys;
                    }
                }
            }
        }
    }
    return ret;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:DocumentationScrollPane.java

示例3: findEditorKeys

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
/** Attempt to find the editor keystroke for the given editor action. */
private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) {
    // This method is implemented due to the issue
    // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action
    KeyStroke[] ret = new KeyStroke[] { defaultKey };
    if (component != null) {
        TextUI componentUI = component.getUI();
        Keymap km = component.getKeymap();
        if (componentUI != null && km != null) {
            EditorKit kit = componentUI.getEditorKit(component);
            if (kit instanceof BaseKit) {
                Action a = ((BaseKit)kit).getActionByName(editorActionName);
                if (a != null) {
                    KeyStroke[] keys = km.getKeyStrokesForAction(a);
                    if (keys != null && keys.length > 0) {
                        ret = keys;
                    }
                }
            }
        }
    }
    return ret;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:DocumentationScrollPane.java

示例4: getEditorTokens

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
private static TraceToken[] getEditorTokens(@NonNull JTextComponent component) {
    TextUI ui = component.getUI();
    if (ui == null) {
        return new TraceToken[0];
    }

    EditorKit kit = ui.getEditorKit(component);
    if (!(kit instanceof LexerDebuggerEditorKit)) {
        return new TraceToken[0];
    }

    Document document = component.getDocument();
    if (document == null) {
        return new TraceToken[0];
    }

    return ((LexerDebuggerEditorKit)kit).getTokens(document);
}
 
開發者ID:tunnelvisionlabs,項目名稱:goworks,代碼行數:19,代碼來源:LexerDebuggerControllerTopComponent.java

示例5: getEditorTransitions

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
private static TupleIntInt[] getEditorTransitions(@NonNull JTextComponent component, boolean atn) {
    TextUI ui = component.getUI();
    if (ui == null) {
        return new TupleIntInt[0];
    }

    EditorKit kit = ui.getEditorKit(component);
    if (!(kit instanceof LexerDebuggerEditorKit)) {
        return new TupleIntInt[0];
    }

    Document document = component.getDocument();
    if (document == null) {
        return new TupleIntInt[0];
    }

    if (atn) {
        return ((LexerDebuggerEditorKit)kit).getAtnTransitions(document);
    } else {
        return ((LexerDebuggerEditorKit)kit).getDfaTransitions(document);
    }
}
 
開發者ID:tunnelvisionlabs,項目名稱:goworks,代碼行數:23,代碼來源:LexerDebuggerControllerTopComponent.java

示例6: findEditorKeys

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
/** Attempt to find the editor keystroke for the given editor action. */
private KeyStroke[] findEditorKeys(String editorActionName) {
    // This method is implemented due to the issue
    // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action
    if (editorActionName != null && getActiveComponent() != null) {
        TextUI ui = getActiveComponent().getUI();
        Keymap km = getActiveComponent().getKeymap();
        if (ui != null && km != null) {
            EditorKit kit = ui.getEditorKit(getActiveComponent());
            if (kit instanceof BaseKit) {
                Action a = ((BaseKit)kit).getActionByName(editorActionName);
                if (a != null) {
                    KeyStroke[] keys = km.getKeyStrokesForAction(a);
                    if (keys != null && keys.length > 0) {
                        return keys;
                    } else {
                        // try kit's keymap
                        Keymap km2 = ((BaseKit)kit).getKeymap();
                        KeyStroke[] keys2 = km2.getKeyStrokesForAction(a);
                        if (keys2 != null && keys2.length > 0) {
                            return keys2;
                        }
                    }
                }
            }
        }
    }
    return new KeyStroke[0];
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:CompletionImpl.java

示例7: findEditorKeys

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
/** Attempt to find the editor keystroke for the given action. */
private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey) {
    KeyStroke[] ret = new KeyStroke[] { defaultKey };
    JTextComponent comp = getComponent();
    if (editorActionName != null && comp != null) {
        TextUI textUI = comp.getUI();
        Keymap km = comp.getKeymap();
        if (textUI != null && km != null) {
            EditorKit kit = textUI.getEditorKit(comp);
            if (kit instanceof BaseKit) {
                Action a = ((BaseKit)kit).getActionByName(editorActionName);
                if (a != null) {
                    KeyStroke[] keys = km.getKeyStrokesForAction(a);
                    if (keys != null && keys.length > 0) {
                        ret = keys;
                    } else {
                        // try kit's keymap
                        Keymap km2 = ((BaseKit)kit).getKeymap();
                        KeyStroke[] keys2 = km2.getKeyStrokesForAction(a);
                        if (keys2 != null && keys2.length > 0) {
                            ret = keys2;
                        }                            
                    }
                }
            }
        }
    }
    return ret;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:NbEditorToolBar.java

示例8: findEditorKeys

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
/** Attempt to find the editor keystroke for the given editor action. */
private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey) {
    // This method is implemented due to the issue
    // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action
    KeyStroke[] ret = new KeyStroke[] { defaultKey };
    if (editorActionName != null && extEditorUI != null) {
        JTextComponent component = extEditorUI.getComponent();
        if (component != null) {
            TextUI ui = component.getUI();
            Keymap km = component.getKeymap();
            if (ui != null && km != null) {
                EditorKit kit = ui.getEditorKit(component);
                if (kit instanceof BaseKit) {
                    Action a = ((BaseKit)kit).getActionByName(editorActionName);
                    if (a != null) {
                        KeyStroke[] keys = km.getKeyStrokesForAction(a);
                        if (keys != null && keys.length > 0) {
                            ret = keys;
                        }
                    }
                }
            }
        }
    }

    return ret;
}
 
開發者ID:CharlesSkelton,項目名稱:studio,代碼行數:28,代碼來源:JDCPopupPanel.java

示例9: propertyChange

import javax.swing.plaf.TextUI; //導入方法依賴的package包/類
public void propertyChange(PropertyChangeEvent evt) {
    if (EditorRegistry.FOCUS_GAINED_PROPERTY.equals(evt.getPropertyName())) {
        JTextComponent focusedTextComponent = (JTextComponent) evt.getNewValue();
        SearchableEditorKit oldActiveKit = activeKit();
        EditorKit kit = null;
        if (focusedTextComponent != null) {
            TextUI ui = focusedTextComponent.getUI();
            if (ui != null) {
                kit = ui.getEditorKit(focusedTextComponent);
            }
        }

        synchronized (PresenterEditorAction.class) {
            SearchableEditorKit newActiveKit = (kit != null)
                    ? EditorActionUtilities.getSearchableKit(kit)
                    : null;
            boolean kitChanged;
            if (newActiveKit != oldActiveKit) {
                if (oldActiveKit != null) {
                    oldActiveKit.removeActionsChangeListener(actionsChangeListener);
                }
                activeKitRef = (newActiveKit != null)
                        ? new WeakReference<SearchableEditorKit>(newActiveKit)
                        : null;
                if (newActiveKit != null) {
                    newActiveKit.addActionsChangeListener(actionsChangeListener);
                }
                kitChanged = true;
            } else {
                kitChanged = false;
            }
            boolean focusChanged = (activeKitLastFocused == false);
            activeKitLastFocused = true;
            if (focusChanged || kitChanged) {
                refreshActiveKitActions(newActiveKit, kitChanged);
            }
        }

    } else if (EditorRegistry.FOCUS_LOST_PROPERTY.equals(evt.getPropertyName())) {
        synchronized (PresenterEditorAction.class) {
            boolean newActiveKitLastFocused = (EditorRegistry.lastFocusedComponent() != null);
            if (newActiveKitLastFocused != activeKitLastFocused) {
                activeKitLastFocused = newActiveKitLastFocused;
                for (PresenterEditorAction a : presenterActions) {
                    a.refreshActiveKitAction(null, false);
                }
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:51,代碼來源:PresenterEditorAction.java


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