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


Java JDialog.getRootPane方法代码示例

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


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

示例1: open

import javax.swing.JDialog; //导入方法依赖的package包/类
public void open(JComponent progressComponent) {
    holder.add(progressComponent, BorderLayout.CENTER);

    DialogDescriptor dd = new DialogDescriptor(
            this,
            NbBundle.getMessage(ProgressPanel.class, "MSG_PleaseWait"),
            true,
            new Object[0],
            DialogDescriptor.NO_OPTION,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null,
            true);
    dialog = DialogDisplayer.getDefault().createDialog(dd);
    if (dialog instanceof JDialog) {
        JDialog jDialog = ((JDialog)dialog);
        jDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        JRootPane rootPane = jDialog.getRootPane();
        rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NOI18N
        rootPane.getActionMap().put("cancel", new AbstractAction() { // NOI18N
            public void actionPerformed(ActionEvent event) {
                if (cancelButton.isEnabled()) {
                    cancelButton.doClick();
                }
            }
        });
    }
    dialog.setResizable(false);
    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ProgressPanel.java

示例2: open

import javax.swing.JDialog; //导入方法依赖的package包/类
public void open(JComponent progressComponent) {
    holder.add(progressComponent, BorderLayout.CENTER);

    DialogDescriptor dd = new DialogDescriptor(
            this,
            NbBundle.getMessage (ProgressPanel.class, "MSG_PleaseWait"),
            true,
            new Object[0],
            DialogDescriptor.NO_OPTION,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null,
            true);
    dialog = DialogDisplayer.getDefault().createDialog(dd);
    if (dialog instanceof JDialog) {
        JDialog jDialog = ((JDialog)dialog);
        jDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        JRootPane rootPane = jDialog.getRootPane();
        rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); // NOI18N
        rootPane.getActionMap().put("cancel", new AbstractAction() { // NOI18N
            public void actionPerformed(ActionEvent event) {
                if (cancelButton.isEnabled()) {
                    cancelButton.doClick();
                }
            }
        });
    }
    dialog.setResizable(false);
    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ProgressPanel.java

示例3: JDialogWindowListener

import javax.swing.JDialog; //导入方法依赖的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


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