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


Java DialogDescriptor.setModal方法代码示例

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


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

示例1: createDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private void createDialog(String title) {
    pHandle = ProgressHandleFactory.createHandle(title);
    JPanel panel = new ProgressPanel(pHandle);
    
    DialogDescriptor descriptor = new DialogDescriptor(
            panel, title
    );
    
    final Object[] OPTIONS = new Object[0];
    descriptor.setOptions(OPTIONS);
    descriptor.setClosingOptions(OPTIONS);
    descriptor.setModal(true);
    descriptor.setOptionsAlign(DialogDescriptor.BOTTOM_ALIGN);
    
    dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    
    Frame mainWindow = WindowManager.getDefault().getMainWindow();
    int windowWidth = mainWindow.getWidth();
    int windowHeight = mainWindow.getHeight();
    int dialogWidth = dialog.getWidth();
    int dialogHeight = dialog.getHeight();
    int dialogX = (int)(windowWidth/2.0) - (int)(dialogWidth/2.0);
    int dialogY = (int)(windowHeight/2.0) - (int)(dialogHeight/2.0);
    
    dialog.setLocation(dialogX, dialogY);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ProgressDialog.java

示例2: display

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Displays dialog. */
public boolean display() {
    String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
    DialogDescriptor dd = new DialogDescriptor(this, title);
    dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
    run.setDefaultCapable(true);
    JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
    dd.setOptions(new Object[] {run, cancel});
    dd.setModal(true);
    Object result = DialogDisplayer.getDefault().notify(dd);
    if (result.equals(run)) {
        try {
            run();
            return true;
        } catch (IOException x) {
            AntModule.err.notify(x);
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AdvancedActionPanel.java

示例3: showAcceptCancelDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/**
 * Show an OK/cancel-type dialog with customized button texts.
 * Only a separate method because it is otherwise cumbersome to replace
 * the OK button with a button that is set as the default.
 * @param title the dialog title
 * @param message the body of the message (usually HTML text)
 * @param acceptButton a label for the default accept button; should not use mnemonics
 * @param accDescrAcceptButton a accessible description for acceptButton 
 * @param cancelButton a label for the cancel button (or null for default); should not use mnemonics
 * @param messageType {@link NotifyDescriptor#WARNING_MESSAGE} or similar
 * @return true if user accepted the dialog
 */
public static boolean showAcceptCancelDialog(String title, String message, 
        String acceptButton, String accDescrAcceptButton , 
        String cancelButton, int messageType) 
{
    DialogDescriptor d = new DialogDescriptor(message, title);
    d.setModal(true);
    JButton accept = new JButton(acceptButton);
    accept.setDefaultCapable(true);
    if ( accDescrAcceptButton != null ){
        accept.getAccessibleContext().
        setAccessibleDescription( accDescrAcceptButton);
    }
    d.setOptions(new Object[] {
        accept,
        cancelButton != null ? new JButton(cancelButton) : NotifyDescriptor.CANCEL_OPTION,
    });
    d.setMessageType(messageType);
    return DialogDisplayer.getDefault().notify(d).equals(accept);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ApisupportAntUIUtils.java

示例4: show

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
void show(boolean valid) {
    setValid(valid);
    
    String title = NbBundle.getMessage(SvnOptionsController.class, "CTL_ManageLabels");
    String accesibleDescription = NbBundle.getMessage(SvnOptionsController.class, "ACSD_ManageLabels");
    HelpCtx helpCtx = new HelpCtx(AnnotationSettings.class);
    
    dialogDescriptor = new DialogDescriptor(panel, title);
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(helpCtx);
    dialogDescriptor.setValid(valid);
    
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(accesibleDescription);
    //dialog.setModal(false);
    dialog.setAlwaysOnTop(false);
    dialog.setVisible(true);                
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AnnotationSettings.java

示例5: show

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private boolean show() {
    final DialogDescriptor dialogDescriptor =
            new DialogDescriptor(getBrowserPanel(), NbBundle.getMessage(Browser.class, "CTL_Browser_BrowseFolders_Title")); // NOI18N
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(new HelpCtx(helpID));
    dialogDescriptor.setValid(false);

    addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if( ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName()) ) {
                Node[] nodes = getSelectedNodes();
                if (nodes != null && nodes.length > 0) {
                    selectedNodes = nodes;
                    dialogDescriptor.setValid(nodes.length > 0);
                }
            }
        }
    });

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Browser.class, "CTL_Browser_BrowseFolders_Title")); // NOI18N
    dialog.setVisible(true);

    return DialogDescriptor.OK_OPTION.equals(dialogDescriptor.getValue());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Browser.java

示例6: FileSelector

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Creates new form RootSelectorPanel */
public FileSelector(String text, String title, HelpCtx helpCtx, Preferences pref) {
    this.text = text;
    this.title = title;
    this.helpCtx = helpCtx;
    this.pref = pref;

    initComponents();

    filesList.addListSelectionListener(this);

    dialogDescriptor = new DialogDescriptor(this, title);

    okButton = new JButton(org.openide.util.NbBundle.getMessage(FileSelector.class, "CTL_FileSelector_Select"));
    okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FileSelector.class, "CTL_FileSelector_Select"));
    okButton.setEnabled(false);
    cancelButton = new JButton(org.openide.util.NbBundle.getMessage(FileSelector.class, "CTL_FileSelector_Cancel"));                                      // NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FileSelector.class, "CTL_FileSelector_Cancel"));    // NOI18N
    dialogDescriptor.setOptions(new Object[] {okButton, cancelButton});

    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass()));
    dialogDescriptor.setValid(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:FileSelector.java

示例7: actionPerformed

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
    AdvancedActionPanel panel = new AdvancedActionPanel(project, allTargets);
    DialogDescriptor dd = new DialogDescriptor(panel, title);
    dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
    run.setDefaultCapable(true);
    JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
    dd.setOptions(new Object[] {run, cancel});
    dd.setModal(true);
    Object result = DialogDisplayer.getDefault().notify(dd);
    if (result.equals(run)) {
        try {
            panel.run();
        } catch (IOException x) {
            AntModule.err.notify(x);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:RunTargetsAction.java

示例8: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private Variable showDialog() {
    JPanel inset = new JPanel(new BorderLayout());
    inset.setBorder(new EmptyBorder(12,12,0,12));
    inset.add(this);
    inset.getAccessibleContext().setAccessibleName(NbBundle.getMessage(VariablesPanel.class, "AN_Manage_Variables"));
    inset.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VariablesPanel.class, "AD_Manage_Variables"));
    DialogDescriptor dd = new DialogDescriptor(inset, NbBundle.getMessage(VariablesPanel.class, "TITLE_Manage_Variables")); // NOI18N
    dd.setModal(true);
    final JButton ok = new JButton(NbBundle.getMessage(VariablesPanel.class, "BUTTON_OK")); // NOI18N
    ok.setDefaultCapable(true);
    explorer.addPropertyChangeListener(new PropertyChangeListener() {
       public void propertyChange(PropertyChangeEvent evt) {
           removeButton.setEnabled(explorer.getSelectedNodes().length > 0);
           editButton.setEnabled(explorer.getSelectedNodes().length == 1);
       }
    });
    dd.setOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    dd.setClosingOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    if (DialogDisplayer.getDefault().notify(dd) == ok) {
        model.save();
        if (explorer.getSelectedNodes().length == 1) {
            return explorer.getSelectedNodes()[0].getLookup().lookup(Variable.class);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:VariablesPanel.java

示例9: showInfo

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Shows info about found hard coded string. */
private void showInfo() {
    JPanel infoPanel = support.getInfo(hcString);

    DialogDescriptor dd = new DialogDescriptor(
            infoPanel,
            I18nUtil.getBundle().getString("CTL_InfoPanelTitle"));  //NOI18N
    
    dd.setModal(true);
    dd.setOptionType(DialogDescriptor.DEFAULT_OPTION);
    dd.setOptions(new Object[] {DialogDescriptor.OK_OPTION});
    dd.setAdditionalOptions(new Object[0]);

    
    Dialog infoDialog = DialogDisplayer.getDefault().createDialog(dd);
    infoDialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:I18nManager.java

示例10: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private void showDialog(DialogDescriptor dialogDescriptor) {
    dialogDescriptor.setModal(true);
    dialogDescriptor.setValid(false);     

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);        
    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SvnClientExceptionHandler.java

示例11: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private void showDialog(DialogDescriptor dialogDescriptor, HelpCtx helpCtx) {
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(helpCtx);        

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);        
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Repository.class, "ACSD_RepositoryPanel"));
    dialog.getAccessibleContext().setAccessibleName(NbBundle.getMessage(Repository.class, "ACSN_RepositoryPanel"));
    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Repository.java

示例12: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public boolean showDialog() {
    DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(UpdateTo.class, "CTL_UpdateToDialog")); // NOI18N
    dialogDescriptor.setOptions(new Object[] {okButton, cancelButton});

    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass()));
    dialogDescriptor.setValid(false);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(UpdateTo.class, "ACSD_UpdateToDialog")); // NOI18N
    dialog.setVisible(true);
    dialog.setResizable(false);
    boolean ret = dialogDescriptor.getValue() == okButton;
    return ret;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:UpdateTo.java

示例13: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public boolean showDialog() {
    DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(RevertModifications.class, "CTL_RevertDialog")); // NOI18N
    dialogDescriptor.setOptions(new Object[] {okButton, cancelButton});
    
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(new HelpCtx(this.getClass()));
    dialogDescriptor.setValid(false);
    
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);     
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RevertModifications.class, "ACSD_RevertDialog")); // NOI18N
    dialog.setVisible(true);
    dialog.setResizable(false);
    boolean ret = dialogDescriptor.getValue() == okButton;
    return ret;       
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:RevertModifications.java

示例14: openProperties

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public static void openProperties(File[] roots, String ctxDisplayName) {
    if(!Subversion.getInstance().checkClientAvailable()) {            
        return;
    }       

    final PropertiesPanel panel = new PropertiesPanel();
    final PropertiesTable propTable;
    propTable = new PropertiesTable(panel.labelForTable, PropertiesTable.PROPERTIES_COLUMNS, new String[] { PropertiesTableModel.COLUMN_NAME_VALUE});
    panel.setPropertiesTable(propTable);

    JComponent component = propTable.getComponent();
    panel.propsPanel.setLayout(new BorderLayout());
    panel.propsPanel.add(component, BorderLayout.CENTER);
    SvnProperties svnProperties = new SvnProperties(panel, propTable, roots);
    JButton btnClose = new JButton();
    Mnemonics.setLocalizedText(btnClose, getString("CTL_Properties_Action_Close"));   //NOI18N
    btnClose.getAccessibleContext().setAccessibleDescription(getString("CTL_Properties_Action_Close")); //NOI18N
    btnClose.getAccessibleContext().setAccessibleName(getString("CTL_Properties_Action_Close"));    //NOI18N

    DialogDescriptor dd = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(SvnPropertiesAction.class, "CTL_PropertiesDialog_Title", ctxDisplayName)); // NOI18N
    dd.setModal(true);
    dd.setOptions(new Object[] {btnClose});
    dd.setHelpCtx(new HelpCtx(SvnPropertiesAction.class));

    panel.putClientProperty("contentTitle", ctxDisplayName);  // NOI18N
    panel.putClientProperty("DialogDescriptor", dd); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SvnPropertiesAction.class, "CTL_PropertiesAction")); // NOI18N
    dialog.pack();
    dialog.setVisible(true);        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:SvnPropertiesAction.java

示例15: showDialog

import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private void showDialog(DialogDescriptor dialogDescriptor, HelpCtx helpCtx, String name) {
    dialogDescriptor.setModal(true);
    dialogDescriptor.setHelpCtx(helpCtx);        

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);        
    if (name != null) {
        dialog.addWindowListener(new DialogBoundsPreserver(HgModuleConfig.getDefault().getPreferences(), name)); // NOI18N
    }
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(Repository.class, "ACSD_RepositoryPanel"));

    dialog.setVisible(true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:Repository.java


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