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


Java JRootPane.getInputMap方法代码示例

本文整理汇总了Java中javax.swing.JRootPane.getInputMap方法的典型用法代码示例。如果您正苦于以下问题:Java JRootPane.getInputMap方法的具体用法?Java JRootPane.getInputMap怎么用?Java JRootPane.getInputMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JRootPane的用法示例。


在下文中一共展示了JRootPane.getInputMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uninstallOperation

import javax.swing.JRootPane; //导入方法依赖的package包/类
/**
 * Removes an operation installed in the specified frame for the specified
 * keystroke and condition.
 * 
 * @param frame
 *            The frame from which the keybind is to be uninstalled.
 * @param condition
 *            When should this keybind be activated.
 *            Either {@link JComponent#WHEN_FOCUSED}, {@link JComponent#WHEN_IN_FOCUSED_WINDOW}, or
 *            {@link JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}.
 * @param keyStroke
 *            The keystroke used to activate the keybind
 */
public static void uninstallOperation(
	final RootPaneContainer frame,
	final int condition,
	final KeyStroke keyStroke )
{
	JRootPane root = frame.getRootPane();

	InputMap inputMap = root.getInputMap( condition );
	InputMap parentMap = inputMap.getParent();

	// Temporarily remove the parent input map, so that we don't receive the
	// action key from the parent's input map if the current input map has
	// no action key bound to the key stroke.
	inputMap.setParent( null );

	Object actionKey = root.getInputMap( condition ).get( keyStroke );
	if ( actionKey == null )
		throw new OperationNotInstalledException( keyStroke );
	root.getInputMap( condition ).remove( keyStroke );
	root.getActionMap().remove( actionKey );

	inputMap.setParent( parentMap );
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:37,代码来源:SwingUIUtils.java

示例2: createRootPane

import javax.swing.JRootPane; //导入方法依赖的package包/类
public JRootPane createRootPane() {
	JRootPane rootPane = new JRootPane();
	KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");
	Action action = new AbstractAction() {
		
		private static final long serialVersionUID = 1L;

		public void actionPerformed(ActionEvent e) {
			System.out.println("escaping..");
			setVisible(false);
			dispose();
		}
	};
	InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	inputMap.put(stroke, "ESCAPE");
	rootPane.getActionMap().put("ESCAPE", action);
	return rootPane;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:19,代码来源:MyJDialog.java

示例3: JDialogWindowListener

import javax.swing.JRootPane; //导入方法依赖的package包/类
/**
 * Constructs
 * 
 * @param objPcontrolJFrame
 * @param objPdialog
 * @param bolPdispose
 */
public JDialogWindowListener(ControlJFrame objPcontrolJFrame, JDialog objPdialog, boolean bolPdispose) {
	this.objGcontrolJFrame = objPcontrolJFrame;
	this.objGjDialog = objPdialog;
	this.bolGdispose = bolPdispose;
	final JRootPane objLrootPane = objPdialog.getRootPane();
	final InputMap objLinputMap = objLrootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	objLinputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), Constants.strS_ENGINE_ESCAPE_ACTION);
	objLrootPane.getActionMap().put(Constants.strS_ENGINE_ESCAPE_ACTION, new DefaultEscapeAction(this));
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:17,代码来源:JDialogWindowListener.java

示例4: setJDialogDefaultKeys

import javax.swing.JRootPane; //导入方法依赖的package包/类
/**
 * Method description
 * 
 * @see
 */
final private void setJDialogDefaultKeys() {

	final JRootPane objLrootPane = this.getRootPane();

	// Enter key :
	objLrootPane.setDefaultButton(this.objGoKJButton);

	// Escape key :
	final InputMap objLinputMap = objLrootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	objLinputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), Constants.strS_ENGINE_ESCAPE_ACTION);
	objLrootPane.getActionMap().put(Constants.strS_ENGINE_ESCAPE_ACTION, new PreferencesEscapeAction(this));
}
 
开发者ID:jugglemaster,项目名称:JuggleMasterPro,代码行数:18,代码来源:PreferencesJDialog.java

示例5: createRootPane

import javax.swing.JRootPane; //导入方法依赖的package包/类
public JRootPane createRootPane() {
	JRootPane rootPane = new JRootPane();
	KeyStroke stroke = KeyStroke.getKeyStroke("ESCAPE");

	@SuppressWarnings("serial")
	Action action = new AbstractAction() {
		public void actionPerformed(ActionEvent e) {
			closeDialog();
		}
	};
	InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	inputMap.put(stroke, "ESCAPE");
	rootPane.getActionMap().put("ESCAPE", action);
	return rootPane;
}
 
开发者ID:ggrupo,项目名称:ataxx,代码行数:16,代码来源:ColorChooserDialog.java

示例6: createRootPane

import javax.swing.JRootPane; //导入方法依赖的package包/类
@Override
public JRootPane createRootPane() {

    rootPane = new JRootPane();
    stroke = KeyStroke.getKeyStroke("ESCAPE");

    action = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {

            setVisible(false);
            dispose();

        }
    };

    
    inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(stroke, "ESCAPE");
    rootPane.getActionMap().put("ESCAPE", action);
    
    return rootPane;
  
}
 
开发者ID:MohammedRashad,项目名称:Hydra-ROV,代码行数:26,代码来源:About.java


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