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


Java SwingUtilities.replaceUIInputMap方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:XTextAreaPeer.java

示例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());
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:FlatterSpinnerUI.java

示例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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:16,代码来源:EuropePanel.java

示例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());
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:15,代码来源:mxKeyboardHandler.java

示例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());
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:mxKeyboardHandler.java

示例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));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:BaseTextUI.java


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