當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。