本文整理汇总了Java中javax.swing.SwingUtilities.replaceUIInputMap方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.replaceUIInputMap方法的具体用法?Java SwingUtilities.replaceUIInputMap怎么用?Java SwingUtilities.replaceUIInputMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.replaceUIInputMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installKeyboardActions
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
protected void installKeyboardActions() {
super.installKeyboardActions();
JTextComponent comp = getComponent();
UIDefaults uidefaults = XToolkit.getUIDefaults();
String prefix = getPropertyPrefix();
InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
if (map != null) {
SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
map);
}
}
示例2: installKeyboardActions
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Installs the KeyboardActions onto the JSpinner.
*/
private void installKeyboardActions()
{
InputMap iMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(spinner, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, iMap);
SwingUtilities.replaceUIActionMap(spinner, getActionMap());
}
示例3: EuropeButton
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public EuropeButton(String text, int keyEvent, String command,
ActionListener listener) {
setOpaque(true);
setText(text);
setActionCommand(command);
addActionListener(listener);
InputMap closeInputMap = new ComponentInputMap(this);
closeInputMap.put(KeyStroke.getKeyStroke(keyEvent, 0, false),
"pressed");
closeInputMap.put(KeyStroke.getKeyStroke(keyEvent, 0, true),
"released");
SwingUtilities.replaceUIInputMap(this,
JComponent.WHEN_IN_FOCUSED_WINDOW,
closeInputMap);
}
示例4: installKeyboardActions
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Invoked as part from the boilerplate install block.
*/
protected void installKeyboardActions(mxGraphComponent graphComponent)
{
InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(graphComponent,
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap);
inputMap = getInputMap(JComponent.WHEN_FOCUSED);
SwingUtilities.replaceUIInputMap(graphComponent,
JComponent.WHEN_FOCUSED, inputMap);
SwingUtilities.replaceUIActionMap(graphComponent, createActionMap());
}
示例5: installKeyboardActions
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Invoked as part from the boilerplate install block.
*/
protected void installKeyboardActions(mxGraphComponent graphComponent) {
InputMap inputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(graphComponent, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
inputMap);
inputMap = getInputMap(JComponent.WHEN_FOCUSED);
SwingUtilities.replaceUIInputMap(graphComponent, JComponent.WHEN_FOCUSED, inputMap);
SwingUtilities.replaceUIActionMap(graphComponent, createActionMap());
}
示例6: installUI
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/** Installs the UI for a component. */
public @Override void installUI(JComponent c) {
super.installUI(c);
if (!(c instanceof JTextComponent)) {
return;
}
JTextComponent component = getComponent();
prefs = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component)).lookup(Preferences.class);
// set margin
String value = prefs.get(SimpleValueNames.MARGIN, null);
Insets margin = value != null ? SettingsConversions.parseInsets(value) : null;
component.setMargin(margin != null ? margin : EditorUI.NULL_INSETS);
getEditorUI().installUI(component);
// attach to the model and component
//component.addPropertyChangeListener(this); already done in super class
if (component.getClientProperty(UIWatcher.class) == null) {
UIWatcher uiWatcher = new UIWatcher(this.getClass());
component.addPropertyChangeListener(uiWatcher);
component.putClientProperty(UIWatcher.class, uiWatcher);
}
BaseKit kit = (BaseKit)getEditorKit(component);
ViewFactory vf = kit.getViewFactory();
// Create and attach caret
Caret defaultCaret = component.getCaret();
Caret caret = kit.createCaret();
component.setCaretColor(Color.black); // will be changed by settings later
component.setCaret(caret);
component.putClientProperty(PROP_DEFAULT_CARET_BLINK_RATE, defaultCaret.getBlinkRate());
component.setKeymap(kit.getKeymap());
// assign blink rate
int br = prefs.getInt(SimpleValueNames.CARET_BLINK_RATE, -1);
if (br == -1) {
br = defaultCaret.getBlinkRate();
}
caret.setBlinkRate(br);
SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null);
EditorApiPackageAccessor.get().register(component);
component.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
}