本文整理汇总了Java中javax.swing.ActionMap.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java ActionMap.getParent方法的具体用法?Java ActionMap.getParent怎么用?Java ActionMap.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.ActionMap
的用法示例。
在下文中一共展示了ActionMap.getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import javax.swing.ActionMap; //导入方法依赖的package包/类
/** Converts an action map to a string representation. */
static public String toString(ActionMap am) {
StringBuilder result = new StringBuilder();
LinkedHashMap<Object,Object> map = new LinkedHashMap<>();
for (Object key : am.allKeys()) {
map.put(key, am.get(key));
}
result.append(map);
result.append('\n');
ActionMap parent = am.getParent();
if (parent != null) {
result.append("Parent: ");
result.append(toString(parent));
}
return result.toString();
}
示例2: initCustomEditorAndDecorationsInEDT
import javax.swing.ActionMap; //导入方法依赖的package包/类
private boolean initCustomEditorAndDecorationsInEDT() {
initCustomEditor();
initDecoration();
editor.remove(loadingLabel);
((QuietEditorPane)pane).setWorking(QuietEditorPane.ALL);
// set the caret to right possition if this component was deserialized
int cursorPosition = editor.getCursorPosition();
if (cursorPosition != -1) {
Caret caret = pane.getCaret();
if (caret != null) {
caret.setDot(cursorPosition);
}
}
ActionMap actionMap = editor.getActionMap();
ActionMap p = actionMap.getParent();
actionMap.setParent(null);
actionMap.setParent(p);
//#134910: If editor TopComponent is already activated request focus
//to it again to get focus to correct subcomponent eg. QuietEditorPane which
//is added above.
if (shouldRequestFocus(pane)) {
EDITOR_LOG.log(Level.FINE, "requestFocusInWindow {0}", pane);
editor.requestFocusInWindow();
}
//#162961, #167289: Force repaint of editor. Sometimes editor stays empty.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
editor.revalidate();
}
});
// Mark the initialization finished here so that CloneableEditor.isEditorPaneReady() returns true
// Do it before custom editor and decorations since they might query getEditorPane()
// which would wait indeinitely for initialization completion.
finishInitialization();
return true;
}