javax.swing.SwingUtilities#replaceUIInputMap ( )源码实例Demo

下面列出了javax.swing.SwingUtilities#replaceUIInputMap ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: XTextFieldPeer.java
@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 项目: TencentKona-8   文件: XTextAreaPeer.java
@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);
    }
}
 
源代码3 项目: TencentKona-8   文件: XTextFieldPeer.java
@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);
    }
}
 
源代码4 项目: openjdk-8-source   文件: XTextFieldPeer.java
@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);
    }
}
 
源代码5 项目: openjdk-8   文件: XTextFieldPeer.java
@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);
    }
}
 
源代码6 项目: diirt   文件: CompareResultImages.java
/**
 * Creates new form CompareResultImages
 */
public CompareResultImages() {
    initComponents();
    toReviewList.setModel(new DefaultListModel());
    fillList();
    setSize(800, 600);
    setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
    actualImage.setStretch(false);
    referenceImage.setStretch(false);
    acceptAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));

    InputMap keyMap = new ComponentInputMap(acceptButton);
    keyMap.put(KeyStroke.getKeyStroke("control D"), "accept");

    ActionMap actionMap = new ActionMapUIResource();
    actionMap.put("accept", acceptAction);

    SwingUtilities.replaceUIActionMap(acceptButton, actionMap);
    SwingUtilities.replaceUIInputMap(acceptButton, JComponent.WHEN_IN_FOCUSED_WINDOW, keyMap);
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: XTextAreaPeer.java
@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);
    }
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: XTextFieldPeer.java
@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);
    }
}
 
源代码9 项目: openjdk-jdk9   文件: XTextAreaPeer.java
@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);
    }
}
 
源代码10 项目: openjdk-jdk9   文件: XTextFieldPeer.java
@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);
    }
}
 
源代码11 项目: hottub   文件: XTextAreaPeer.java
@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);
    }
}
 
源代码12 项目: blog-codes   文件: mxKeyboardHandler.java
/**
 * 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());
}
 
源代码13 项目: FlatLaf   文件: FlatScrollBarUI.java
@Override
protected PropertyChangeListener createPropertyChangeListener() {
	return new BasicScrollBarUI.PropertyChangeHandler() {
		@Override
		public void propertyChange( PropertyChangeEvent e ) {
			super.propertyChange( e );

			switch( e.getPropertyName() ) {
				case FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS:
					scrollbar.revalidate();
					scrollbar.repaint();
					break;

				case "componentOrientation":
					// this is missing in BasicScrollBarUI.Handler.propertyChange()
					InputMap inputMap = (InputMap) UIManager.get( "ScrollBar.ancestorInputMap" );
					if( !scrollbar.getComponentOrientation().isLeftToRight() ) {
						InputMap rtlInputMap = (InputMap) UIManager.get( "ScrollBar.ancestorInputMap.RightToLeft" );
						if( rtlInputMap != null ) {
							rtlInputMap.setParent( inputMap );
							inputMap = rtlInputMap;
						}
					}
					SwingUtilities.replaceUIInputMap( scrollbar, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap );
					break;
			}
		}
	};
}
 
源代码14 项目: iBioSim   文件: CloseTabPaneUI.java
/**
 * Installs the state needed for mnemonics.
 */
private void initMnemonics() {
	mnemonicToIndexMap = new Hashtable<Integer, Integer>();
	mnemonicInputMap = new InputMapUIResource();
	mnemonicInputMap.setParent(SwingUtilities.getUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT));
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, mnemonicInputMap);
}
 
源代码15 项目: radiance   文件: TabPagerWidget.java
private void uninstallMaps() {
    InputMap currMap = SwingUtilities.getUIInputMap(this.jcomp,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    InputMap newMap = new InputMap();
    if (currMap != null) {
        KeyStroke[] kss = currMap.allKeys();
        for (int i = 0; i < kss.length; i++) {
            KeyStroke stroke = kss[i];
            Object val = currMap.get(stroke);
            if (stroke
                    .equals(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_DOWN_MASK))) {
                if ("tabSwitcherForward".equals(val))
                    continue;
            }
            if (stroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_DOWN_MASK))) {
                if ("tabSwitcherBackward".equals(val))
                    continue;
            }
            if (stroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, 0, true))) {
                if ("tabSwitcherClose".equals(val))
                    continue;
            }
            if (stroke.equals(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0))) {
                if ("tabSwitcherHide".equals(val))
                    continue;
            }
            newMap.put(stroke, val);
        }
    }

    this.jcomp.getActionMap().remove("tabSwitcherForward");
    this.jcomp.getActionMap().remove("tabSwitcherBackward");
    this.jcomp.getActionMap().remove("tabSwitcherClose");
    this.jcomp.getActionMap().remove("tabSwitcherHide");

    SwingUtilities.replaceUIInputMap(this.jcomp, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
            newMap);
}
 
源代码16 项目: freecol   文件: EuropePanel.java
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);
}
 
源代码17 项目: lizzie   文件: BasicLizziePaneUI.java
protected void uninstallKeyboardActions() {
  SwingUtilities.replaceUIActionMap(lizziePane, null);
  SwingUtilities.replaceUIInputMap(
      lizziePane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
}
 
源代码18 项目: iBioSim   文件: CloseTabPaneUI.java
@Override
protected void uninstallKeyboardActions() {
	SwingUtilities.replaceUIActionMap(tabPane, null);
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
	SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, null);
}
 
源代码19 项目: tn5250j   文件: BasicTerminalUI.java
protected void uninstallKeyboardActions()
{
  SwingUtilities.replaceUIInputMap(terminal, JComponent.WHEN_FOCUSED, null);
  SwingUtilities.replaceUIActionMap(terminal, null);
}
 
源代码20 项目: netbeans   文件: BaseTextUI.java
/** 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));
}