Java 类java.awt.Dialog 实例源码

项目:alevin-svn2    文件:MultiAlgoScenarioWizard.java   
private void showConfigurationDialog(ITopologyGenerator generator) {
    JDialog dialog = new JDialog();
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    dialog.setLayout(new BorderLayout());
    dialog.setTitle(generator.getName());
    dialog.add(generator.getConfigurationDialog(), BorderLayout.CENTER);

    Rectangle tbounds = this.getBounds();
    Rectangle bounds = new Rectangle();
    bounds.setSize(generator.getConfigurationDialog().getPreferredSize());
    bounds.x = (int) (tbounds.x + 0.5 * tbounds.width - 0.5 * bounds.width);
    bounds.y = (int) (tbounds.y + 0.5 * tbounds.height - 0.5 * bounds.height);
    dialog.setBounds(bounds);
    dialog.setResizable(false);

    dialog.setVisible(true);
}
项目:VASSAL-src    文件:GenericListener.java   
/**
 * Return true if the given component is likely to be a container such the each
 * component within the container should be be considered as a user input.
 * 
 * @param c
 * @return true if the component children should have this listener added.
 */
protected boolean isProbablyAContainer (Component c) {
    boolean result = extListener != null ? extListener.isContainer(c) : false;
    if (!result) {
        boolean isSwing = isSwingClass(c);
        if (isSwing) {
           result = c instanceof JPanel || c instanceof JSplitPane || c instanceof
                   JToolBar || c instanceof JViewport || c instanceof JScrollPane ||
                   c instanceof JFrame || c instanceof JRootPane || c instanceof
                   Window || c instanceof Frame || c instanceof Dialog ||
                   c instanceof JTabbedPane || c instanceof JInternalFrame ||
                   c instanceof JDesktopPane || c instanceof JLayeredPane;
        } else {
            result = c instanceof Container;
        }
    }
    return result;
}
项目:incubator-netbeans    文件:NotificationLineSupportTest.java   
public void testSetMessageBeforeCreateDialog () {
    DialogDescriptor dd = new DialogDescriptor ("Test", "Test dialog", false, options,
            closeButton, NotifyDescriptor.PLAIN_MESSAGE, null, null);
    assertNull ("No NotificationLineSupport created.", dd.getNotificationLineSupport ());
    NotificationLineSupport supp = dd.createNotificationLineSupport ();
    assertNotNull ("NotificationLineSupport is created.", dd.getNotificationLineSupport ());

    assertNotNull ("NotificationLineSupport not null", supp);
    testSetInformationMessage (supp, "Hello");

    Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
    d.setVisible (true);

    JLabel notificationLabel = findNotificationLabel (d);
    assertNotNull (notificationLabel);

    assertEquals ("Hello", notificationLabel.getText ());
    closeButton.doClick ();
}
项目:jdk8u-jdk    文件:JOptionPane.java   
private JDialog createDialog(Component parentComponent, String title,
        int style)
        throws HeadlessException {

    final JDialog dialog;

    Window window = JOptionPane.getWindowForComponent(parentComponent);
    if (window instanceof Frame) {
        dialog = new JDialog((Frame)window, title, true);
    } else {
        dialog = new JDialog((Dialog)window, title, true);
    }
    if (window instanceof SwingUtilities.SharedOwnerFrame) {
        WindowListener ownerShutdownListener =
                SwingUtilities.getSharedOwnerFrameShutdownListener();
        dialog.addWindowListener(ownerShutdownListener);
    }
    initDialog(dialog, style, parentComponent);
    return dialog;
}
项目:incubator-netbeans    文件:CustomizerLibraries.java   
@Messages("CTL_EditModuleDependencyTitle=Edit Module Dependency")
private void editModuleDependency(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editModuleDependency
    ModuleDependency origDep = getDepListModel().getDependency(
            dependencyList.getSelectedIndex());
    EditDependencyPanel editPanel = new EditDependencyPanel(
            origDep, getProperties().getActivePlatform());
    DialogDescriptor descriptor = new DialogDescriptor(editPanel,
            CTL_EditModuleDependencyTitle());
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditDependencyPanel"));
    Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
    d.setVisible(true);
    if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
        getDepListModel().editDependency(origDep, editPanel.getEditedDependency());
    }
    d.dispose();
    dependencyList.requestFocusInWindow();
}
项目:incubator-netbeans    文件:NodeOperationImpl.java   
private static Dialog findCachedPropertiesDialog( Node[] nodes ) {
    for( Iterator<Node[]> it=nodeCache.iterator(); it.hasNext(); ) {
        Node[] cached = it.next();
        if( cached.length != nodes.length )
            continue;
        boolean match = true;
        for( int i=0; i<cached.length; i++ ) {
            if( !cached[i].equals( nodes[i] ) ) {
                match = false;
                break;
            }
        }
        if( match ) {
            return dialogCache.get( cached );
        }
    }
    return null;
}
项目:openjdk-jdk10    文件:HiDPIPropertiesUnixTest.java   
private static void testScale(double scaleX, double scaleY) {

        Dialog dialog = new Dialog((Frame) null, true) {

            @Override
            public void paint(Graphics g) {
                super.paint(g);
                AffineTransform tx = ((Graphics2D) g).getTransform();
                dispose();
                if (scaleX != tx.getScaleX() || scaleY != tx.getScaleY()) {
                    throw new RuntimeException(String.format("Wrong scale:"
                            + "[%f, %f] instead of [%f, %f].",
                            tx.getScaleX(), tx.getScaleY(), scaleX, scaleY));
                }
            }
        };
        dialog.setSize(200, 300);
        dialog.setVisible(true);
    }
项目:incubator-netbeans    文件:WindowBuilders.java   
static ComponentBuilder getBuilder(Instance instance, Heap heap) {
    if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) {
        return new JRootPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) {
        return new JDesktopPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) {
        return new JLayeredPaneBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) {
        return new FrameBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) {
        return new DialogBuilder(instance, heap);
    } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) {
        return new JInternalFrameBuilder(instance, heap);
    }
    return null;
}
项目:incubator-netbeans    文件:CustomizerProviderImpl.java   
public void actionPerformed( ActionEvent e ) {
            for (ActionListener al : uiProperties.getOptionListeners()) {
                al.actionPerformed(e);
            }

//#95952 some users experience this assertion on a fairly random set of changes in 
// the customizer, that leads me to assume that a project can be already marked
// as modified before the project customizer is shown. 
//            assert !ProjectManager.getDefault().isModified(project) : 
//                "Some of the customizer panels has written the changed data before OK Button was pressed. Please file it as bug."; //NOI18N
            // Close & dispose the the dialog
            Dialog dialog = project2Dialog.get(project);
            if ( dialog != null ) {
                dialog.setVisible(false);
                dialog.dispose();
            }
        }
项目:jdk8u-jdk    文件:MultiResolutionSplashTest.java   
static float getScaleFactor() {

        final Dialog dialog = new Dialog((Window) null);
        dialog.setSize(100, 100);
        dialog.setModal(true);
        final float[] scaleFactors = new float[1];
        Panel panel = new Panel() {

            @Override
            public void paint(Graphics g) {
                float scaleFactor = 1;
                if (g instanceof SunGraphics2D) {
                    scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
                }
                scaleFactors[0] = scaleFactor;
                dialog.setVisible(false);
            }
        };

        dialog.add(panel);
        dialog.setVisible(true);
        dialog.dispose();

        return scaleFactors[0];
    }
项目:incubator-netbeans    文件:BranchSelector.java   
public boolean showDialog (JButton okButton, String title, String branchListDescription) {
    this.okButton = okButton;
    org.openide.awt.Mnemonics.setLocalizedText(panel.jLabel1, branchListDescription);
    DialogDescriptor dialogDescriptor = new DialogDescriptor(panel, title, true, new Object[] {okButton, cancelButton}, 
            okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(this.getClass()), null);

    dialogDescriptor.setValid(false);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);     
    dialog.getAccessibleContext().setAccessibleDescription(title);
    loadRevisions();
    dialog.setVisible(true);
    HgProgressSupport supp = loadingSupport;
    if (supp != null) {
        supp.cancel();
    }
    boolean ret = dialogDescriptor.getValue() == okButton;
    return ret;
}
项目:incubator-netbeans    文件:NbApplicationAdapter.java   
void handleAbout() {
    //#221571 - check if About window is showing already
    Window[] windows = Dialog.getWindows();
    if( null != windows ) {
        for( Window w : windows ) {
            if( w instanceof JDialog ) {
                JDialog dlg = (JDialog) w;
                if( Boolean.TRUE.equals(dlg.getRootPane().getClientProperty("nb.about.dialog") ) ) { //NOI18N
                    if( dlg.isVisible() ) {
                        dlg.toFront();
                        return;
                    }
                }
            }
        }
    }
    performAction("Help", "org.netbeans.core.actions.AboutAction"); // NOI18N
}
项目:jdk8u-jdk    文件:MissingEventsOnModalDialogTest.java   
private static void showModalDialog(Frame targetFrame) {

        Dialog dialog = new Dialog(targetFrame, true);

        dialog.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                passed = true;
                dialog.dispose();
            }
        });

        dialog.setSize(400, 300);
        dialog.setTitle("Modal Dialog!");

        clickOnModalDialog(dialog);
        dialog.setVisible(true);
    }
项目:incubator-netbeans    文件:OutlineView152857Test.java   
public void testRemoveNodeInOutlineView () throws InterruptedException {
    StringKeys children = new StringKeys (true);
    children.doSetKeys (new String [] {"1", "3", "2"});
    Node root = new TestNode (children, "root");
    comp = new OutlineViewComponent (root);
    ETableColumnModel etcm = (ETableColumnModel) comp.getOutlineView ().getOutline ().getColumnModel ();
    ETableColumn etc = (ETableColumn) etcm.getColumn (0); // tree column
    etcm.setColumnSorted (etc, true, 1); // ascending order

    TreeNode ta = Visualizer.findVisualizer(root);

    DialogDescriptor dd = new DialogDescriptor (comp, "", false, null);
    Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
    d.setVisible (true);

    Thread.sleep (1000);
    ((StringKeys) root.getChildren ()).doSetKeys (new String [] {"1", "2"});
    Thread.sleep (1000);

    assertEquals ("Node on 0nd position is '1'", "1", ta.getChildAt (0).toString ());
    assertEquals ("Node on 1st position is '2'", "2", ta.getChildAt (1).toString ());

    d.setVisible (false);
}
项目:incubator-netbeans    文件:TreeTableView152857Test.java   
public void testRemoveNodeInTTV () throws InterruptedException {
    StringKeys children = new StringKeys (true);
    children.doSetKeys (new String [] {"1", "3", "2"});
    Node root = new TestNode (children, "root");
    view = new TTV (root);
    TreeNode ta = Visualizer.findVisualizer(root);

    DialogDescriptor dd = new DialogDescriptor (view, "", false, null);
    Dialog d = DialogDisplayer.getDefault ().createDialog (dd);
    makeVisible(d);
    ((StringKeys) root.getChildren ()).doSetKeys (new String [] {"1", "2"});
    Thread.sleep (1000);

    assertEquals ("Node on 0nd position is '1'", "1", ta.getChildAt (0).toString ());
    assertEquals ("Node on 1st position is '2'", "2", ta.getChildAt (1).toString ());

    d.setVisible (false);
}
项目:incubator-netbeans    文件:FileChooserBuilderTest.java   
private static AbstractButton findDefaultButton(Container c, String txt) {
    if (c instanceof RootPaneContainer) {
        JRootPane root = ((RootPaneContainer) c).getRootPane();
        if (root == null) {
            return null;
        }
        AbstractButton btn = root.getDefaultButton();
        if (btn == null) {
            //Metal L&F does not set default button for JFileChooser
            Container parent = c;
            while (parent.getParent() != null && !(parent instanceof Dialog)) {
                parent = parent.getParent();
            }
            if (parent instanceof Dialog) {
                return findFileChooserAcceptButton ((Dialog) parent, txt);
            }
        } else {
            return btn;
        }
    }
    return null;
}
项目:incubator-netbeans    文件:GetPortMappingsAction.java   
@NbBundle.Messages({
    "LBL_PortBindings=Port Bindings",
})
@Override
protected void performAction(DockerContainer container) throws DockerException {
    DockerAction facade = new DockerAction(container.getInstance());
    DockerContainerDetail details = facade.getDetail(container);
    List<PortMapping> portMappings = details.portMappings();
    final ViewPortBindingsPanel panel = new ViewPortBindingsPanel(portMappings);

    DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.LBL_PortBindings(),
                                                       true, new Object[] {DialogDescriptor.OK_OPTION}, null,
                                                       DialogDescriptor.DEFAULT_ALIGN, null, null);
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(descriptor);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
}
项目:incubator-netbeans    文件:LoremIpsumGenerator.java   
/**
 * This will be invoked when user chooses this Generator from Insert Code
 * dialog
 */
@Override
public void invoke() {
    final int caretOffset = textComp.getCaretPosition();
    final LoremIpsumPanel panel = new LoremIpsumPanel(completeParagraphList());
    String title = NbBundle.getMessage(LoremIpsumGenerator.class, "LBL_generate_lorem_ipsum"); //NOI18N
    DialogDescriptor dialogDescriptor = createDialogDescriptor(panel, title);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
    dialog.setVisible(true);
    if (dialogDescriptor.getValue() == dialogDescriptor.getDefaultValue()) {
        insertLoremIpsumText((BaseDocument) textComp.getDocument(),
                panel.getParagraphs(),
                panel.getTag(),
                caretOffset);
    }
}
项目:incubator-netbeans    文件:JFXDeploymentPanel.java   
private void buttonIconsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonIconsActionPerformed
    JFXIconsPanel panel = new JFXIconsPanel(jfxProps, lastImageFolder);
    panel.registerDocumentListeners();
    DialogDescriptor dialogDesc = new DialogDescriptor(panel, NbBundle.getMessage(JFXIconsPanel.class, "TITLE_JFXIconsPanel"), true, null); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDesc);
    dialog.setVisible(true);
    if (dialogDesc.getValue() == DialogDescriptor.OK_OPTION) {
        panel.store();
        refreshIconsLabel();
    }
    panel.unregisterDocumentListeners();
}
项目:incubator-netbeans    文件:VersioningInfo.java   
/**
 * Shows a dialog listing all given versioning info properties.
 * @param properties
 */
public static void show (HashMap<File, Map<String, String>> properties) {
    PropertySheet ps = new PropertySheet();
    ps.setNodes(new VersioningInfoNode[] {new VersioningInfoNode(properties)});
    DialogDescriptor dd = new DialogDescriptor(ps, NbBundle.getMessage(VersioningInfo.class, "MSG_VersioningInfo_title"), //NOI18N
            true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.addWindowListener(new DialogBoundsPreserver(NbPreferences.forModule(VersioningInfo.class), "versioning.util.versioningInfo")); //NOI18N
    dialog.setVisible(true);
}
项目:incubator-netbeans    文件:JavaHelp.java   
private Dialog currentModalDialog() {
    if (currentModalDialogs.empty()) {
        Window w = HelpAction.WindowActivatedDetector.getCurrentActivatedWindow();
        if (!currentModalDialogsReady && (w instanceof Dialog) &&
                !(w instanceof ProgressDialog) && w != dialogViewer && ((Dialog)w).isModal()) {
            // #21286. A modal dialog was opened before JavaHelp was even created.
            Installer.log.fine("Early-opened modal dialog: " + w.getName() + " [" + ((Dialog)w).getTitle() + "]");
            return (Dialog)w;
        } else {
            return null;
        }
    } else {
        return currentModalDialogs.peek();
    }
}
项目:rapidminer    文件:ButtonDialog.java   
/**
 * @deprecated Use {@link ButtonDialogBuilder} instead
 */
@Deprecated
public ButtonDialog(Dialog owner, String key, Object... arguments) {
    super(owner, I18N.getMessage(I18N.getGUIBundle(), "gui.dialog." + key + ".title", arguments), false);
    this.arguments = arguments;
    configure(key);
    pack();
    ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_DIALOG, key, "open");
    checkForEDT();
}
项目:incubator-netbeans    文件:CertPassphraseDlg.java   
@Override
public boolean askPassword(ExecutionEnvironment execEnv, String key) {
    Mnemonics.setLocalizedText(promptLabel, NbBundle.getMessage(CertPassphraseDlg.class, "CertPassphraseDlg.promptLabel.text", key)); // NOI18N

    tfUser.setText(execEnv.getUser());

    String hostName = execEnv.getHost();
    if (execEnv.getSSHPort() != 22) {
        hostName += ":" + execEnv.getSSHPort(); //NOI18N
    }
    tfHost.setText(hostName); // NOI18N

    DialogDescriptor dd = new DialogDescriptor(this,
            NbBundle.getMessage(CertPassphraseDlg.class, "CertPassphraseDlg.title.text"), // NOI18N
            true, // NOI18N
            new Object[]{
                DialogDescriptor.OK_OPTION,
                DialogDescriptor.CANCEL_OPTION},
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.DEFAULT_ALIGN, null, null);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setResizable(false);

    try {
        dialog.setVisible(true);
    } catch (Throwable th) {
        if (!(th.getCause() instanceof InterruptedException)) {
            throw new RuntimeException(th);
        }
        dd.setValue(DialogDescriptor.CANCEL_OPTION);
    } finally {
        dialog.dispose();
    }

    return dd.getValue() == DialogDescriptor.OK_OPTION;
}
项目:openjdk-jdk10    文件:FocusTransferWDFDocModal1Test.java   
public static void main(String[] args) throws Exception {
    FocusTransferWDFTest test = new FocusTransferWDFTest(
            Dialog.ModalityType.DOCUMENT_MODAL,
            FocusTransferWDFTest.DialogParent.FRAME,
            FocusTransferWDFTest.WindowParent.NEW_FRAME);
    test.doTest();
}
项目:jmt    文件:DefaultsEditor.java   
/**
 * Returns a new instance of DefaultsEditor, given parent container (used to find
 * top level Dialog or Frame to create this dialog as modal)
 * @param parent any type of container contained in a Frame or Dialog
 * @param target Used to specify to show specific parameters for JMODEL or JSIM
 * @return new instance of DefaultsEditor
 */
public static DefaultsEditor getInstance(Container parent, int target) {
    // Finds top level Dialog or Frame to invoke correct costructor
    while (!(parent instanceof Frame || parent instanceof Dialog)) {
        parent = parent.getParent();
    }

    if (parent instanceof Frame) {
        return new DefaultsEditor((Frame) parent, target);
    } else {
        return new DefaultsEditor((Dialog) parent, target);
    }
}
项目:incubator-netbeans    文件:HardStringWizardPanel.java   
/** Constructor. */
public CustomizeCellEditor() {
    editorComponent = new JButton("..."); // NOI18N

    editorComponent.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            PropertyPanel panel = i18nString.getSupport().getPropertyPanel();
            I18nString clone = (I18nString) i18nString.clone();
            panel.setI18nString(i18nString);

            String title = Util.getString("PROP_cust_dialog_name"); //NOI18N
            DialogDescriptor dd = new DialogDescriptor(panel, title);
            dd.setModal(true);
            dd.setOptionType(DialogDescriptor.DEFAULT_OPTION);

            Object options[] =  new Object[] {
                DialogDescriptor.OK_OPTION,
                DialogDescriptor.CANCEL_OPTION,
            };                    
            dd.setOptions(options);
            //dd.setAdditionalOptions(new Object[0]);
            dd.setHelpCtx(new HelpCtx(I18nUtil.PE_I18N_STRING_HELP_ID));
            dd.setButtonListener(CustomizeCellEditor.this);

            Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
            dialog.setVisible(true);
            if (dd.getValue() == DialogDescriptor.CANCEL_OPTION) {
                i18nString.become(clone);
            }
        }
    });
}
项目:rapidminer    文件:BookmarkDialog.java   
public BookmarkDialog(Dialog top, boolean modal) {
    super(top, modal);
    try {
        init();
    } catch (Exception ex) {
    }
}
项目:incubator-netbeans    文件:ChooseBeanInitializer.java   
@Override
public boolean prepare(PaletteItem item, FileObject classPathRep) {
    ChooseBeanPanel panel = new ChooseBeanPanel();
    DialogDescriptor dd = new DialogDescriptor(panel,
            NbBundle.getMessage(ChooseBeanInitializer.class, "TITLE_Choose_Bean")); // NOI18N
    dd.setOptionType(DialogDescriptor.OK_CANCEL_OPTION);
    HelpCtx.setHelpIDString(panel, "f1_gui_choose_bean_html"); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    String className = null;
    boolean invalidInput;
    do {
        invalidInput = false;
        dialog.setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            className = panel.getEnteredName();
            String checkName;
            if (className != null && className.endsWith(">") && className.indexOf("<") > 0) { // NOI18N
                checkName = className.substring(0, className.indexOf("<")); // NOI18N
            } else {
                checkName = className;
            }
            if (!SourceVersion.isName(checkName)) {
                invalidInput = true;
                DialogDisplayer.getDefault().notify(
                    new NotifyDescriptor.Message(NbBundle.getMessage(ChooseBeanInitializer.class, "MSG_InvalidClassName"), // NOI18N
                                                 NotifyDescriptor.WARNING_MESSAGE));
            } else if (!PaletteItem.checkDefaultPackage(checkName, classPathRep)) {
                invalidInput = true;
            }
        } else {
            return false;
        }
    } while (invalidInput);
    item.setClassFromCurrentProject(className, classPathRep);
    return true;
}
项目:incubator-netbeans    文件:DialogSupport.java   
public Dialog createDialog(
    String title, JPanel panel, boolean modal, 
    JButton[] buttons, boolean sidebuttons, int defaultIndex, 
    int cancelIndex, ActionListener listener)
{
    return origFactory.createDialog(title, panel, modal, 
        buttons, sidebuttons, defaultIndex, cancelIndex, listener);
}
项目:incubator-netbeans    文件:JWSCustomizerPanel.java   
private void appletParamsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_appletParamsButtonActionPerformed

    List<Map<String,String>> origProps = jwsProps.getAppletParamsProperties();
    List<Map<String,String>> props = copyList(origProps);
    TableModel appletParamsTableModel = new JWSProjectProperties.PropertiesTableModel(props, JWSProjectProperties.appletParamsSuffixes, appletParamsColumnNames);
    JPanel panel = new AppletParametersPanel((PropertiesTableModel) appletParamsTableModel, jwsProps.appletWidthDocument, jwsProps.appletHeightDocument);
    DialogDescriptor dialogDesc = new DialogDescriptor(panel, NbBundle.getMessage(JWSCustomizerPanel.class, "TITLE_AppletParameters"), true, null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDesc);
    dialog.setVisible(true);
    if (dialogDesc.getValue() == DialogDescriptor.OK_OPTION) {
        jwsProps.setAppletParamsProperties(props);
    }
    dialog.dispose();

}
项目:incubator-netbeans    文件:RemoteTerminalAction.java   
@Override
protected ExecutionEnvironment getEnvironment() {
    String title = NbBundle.getMessage(RemoteTerminalAction.class, "RemoteConnectionTitle");
    cfgPanel.init();
    DialogDescriptor dd = new DialogDescriptor(cfgPanel, title, // NOI18N
            true, DialogDescriptor.OK_CANCEL_OPTION,
            DialogDescriptor.OK_OPTION, null);

    Dialog cfgDialog = DialogDisplayer.getDefault().createDialog(dd);

    try {
        cfgDialog.setVisible(true);
    } catch (Throwable th) {
        if (!(th.getCause() instanceof InterruptedException)) {
            throw new RuntimeException(th);
        }
        dd.setValue(DialogDescriptor.CANCEL_OPTION);
    } finally {
        cfgDialog.dispose();
    }

    if (dd.getValue() != DialogDescriptor.OK_OPTION) {
        return null;
    }

    final ExecutionEnvironment env = cfgPanel.getExecutionEnvironment();
    return env;
}
项目:incubator-netbeans    文件:AboutAction.java   
public void performAction () {
    DialogDescriptor descriptor = new DialogDescriptor(
        new org.netbeans.core.ui.ProductInformationPanel (),
        NbBundle.getMessage(AboutAction.class, "About_title"),
        true,
            new Object[0],
            null,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null);
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(descriptor);
        if( Utilities.isMac() && dlg instanceof JDialog ) {
            JDialog d = (JDialog) dlg;
            InputMap map = d.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
            map.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.META_MASK), "Escape"); //NOI18N
            //#221571
            d.getRootPane().putClientProperty("nb.about.dialog", Boolean.TRUE); //NOI18N
        }
        dlg.setResizable(false);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
}
项目:incubator-netbeans    文件:RevertPanel.java   
boolean open() {
    final DialogDescriptor dd = 
        new DialogDescriptor (
            this, 
            NbBundle.getMessage(RevertDeletedAction.class, "LBL_SELECT_FILES"), // NOI18N
            true, 
            DialogDescriptor.OK_CANCEL_OPTION, 
            DialogDescriptor.OK_OPTION, 
            null); 
    final Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setVisible(true);
    return dd.getValue() == DialogDescriptor.OK_OPTION;
}
项目:QN-ACTR-Release    文件:AboutDialogFactory.java   
/**
 * Creates a new modal JMTDialog with specified owner and with panel inside, displaying current text.
 * @param owner owner of the dialog. If it's null or invalid, created dialog will not
 * be modal
 * @param title title of dialog to be created
 * @return created dialog
 */
protected static JMTDialog createDialog(Window owner, String title) {
    final JMTDialog dialog;
    if (owner == null) {
        dialog = new JMTDialog();
    } else if (owner instanceof Dialog) {
        dialog = new JMTDialog((Dialog) owner, true);
    } else if (owner instanceof Frame) {
        dialog = new JMTDialog((Frame) owner, true);
    } else {
        dialog = new JMTDialog();
    }
    dialog.setTitle(title);
    dialog.getContentPane().setLayout(new BorderLayout());
    dialog.getContentPane().add(panel, BorderLayout.CENTER);

    // Sets text to be displayed
    textArea.setText("<html><p><font size=\"-1\">" + WEBSITE + "<br><br>" + text + "</font></p></html>");

    // Adds exit button
    JButton exit = new JButton();
    exit.setText("Close");
    exit.addActionListener(new ActionListener() {

        /**
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {
            dialog.close();
        }
    });

    JPanel bottom = new JPanel();
    bottom.add(exit);
    dialog.getContentPane().add(bottom, BorderLayout.SOUTH);
    dialog.centerWindow(450, 500);
    return dialog;
}
项目:incubator-netbeans    文件:ProjectCustomizerListenersTest.java   
public Dialog createDialog(DialogDescriptor descriptor) {
    Object[] options = descriptor.getOptions();
    if (options[0] instanceof JButton) {
        ((JButton) options[0]).doClick();
    }
    return new JDialog();
}
项目:jdk8u-jdk    文件:DialogAboveFrameTest.java   
public static void main(String[] args) {
    Robot robot = Util.createRobot();

    Frame frame = new Frame("Frame");
    frame.setBackground(Color.BLUE);
    frame.setBounds(200, 50, 300, 300);
    frame.setVisible(true);

    Dialog dialog1 = new Dialog(frame, "Dialog 1", false);
    dialog1.setBackground(Color.RED);
    dialog1.setBounds(100, 100, 200, 200);
    dialog1.setVisible(true);

    Dialog dialog2 = new Dialog(frame, "Dialog 2", false);
    dialog2.setBackground(Color.GREEN);
    dialog2.setBounds(400, 100, 200, 200);
    dialog2.setVisible(true);

    Util.waitForIdle(robot);

    Util.clickOnComp(dialog2, robot);
    Util.waitForIdle(robot);

    Point point = dialog1.getLocationOnScreen();
    int x = point.x + (int)(dialog1.getWidth() * 0.9);
    int y = point.y + (int)(dialog1.getHeight() * 0.9);

    try {
        if (!Util.testPixelColor(x, y, dialog1.getBackground(), 10, 100, robot)) {
            throw new RuntimeException("Test FAILED: Dialog is behind the frame");
        }
    } finally {
        frame.dispose();
        dialog1.dispose();
        dialog2.dispose();
    }
}
项目:incubator-netbeans    文件:ExportBundle.java   
@Override
public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    DialogDescriptor dd = new DialogDescriptor(changesetPickerPanel,
            org.openide.util.NbBundle.getMessage(ExportBundle.class, "CTL_ExportBundle.ChangesetPicker_Title"), // NOI18N
            true,
            new Object[]{selectButton, DialogDescriptor.CANCEL_OPTION},
            selectButton,
            DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.mercurial.ui.repository.ChangesetPickerPanel"), //NOI18N
            null);
    selectButton.setEnabled(changesetPickerPanel.getSelectedRevision() != null);
    changesetPickerPanel.addPropertyChangeListener(this);
    changesetPickerPanel.initRevisions();
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setVisible(true);
    changesetPickerPanel.removePropertyChangeListener(this);
    if (dd.getValue() == selectButton) {
        HgLogMessage revisionWithChangeset = changesetPickerPanel.getSelectedRevision();
        String revision = ChangesetPickerPanel.HG_TIP.equals(revisionWithChangeset.getRevisionNumber()) ? ChangesetPickerPanel.HG_TIP
                : new StringBuilder(revisionWithChangeset.getRevisionNumber()).append(SEP).append("(").append(revisionWithChangeset.getCSetShortID()).append(")").toString();
        if (ExportBundlePanel.CMD_SELECT_BASE_REVISION.equals(command)) {
            panel.baseRevision.setModel(new DefaultComboBoxModel(new String[] {HG_NULL_BASE, revision})); //NOI18N
            panel.baseRevision.setSelectedItem(revision);
        } else if (ExportBundlePanel.CMD_SELECT_REVISION.equals(command)) {
            panel.txtTopRevision.setText(revision);
        }
    }
}
项目:incubator-netbeans    文件:I18nTestWizardAction.java   
/** 
 * We create non-modal but not rentrant dialog. Wait until
 * previous one is closed.
 */
protected boolean enable(Node[] activatedNodes) {

    if (Util.wizardEnabled(activatedNodes) == false) {
        return false;
    }

    Dialog previous = (Dialog) dialogWRef.get();
    if (previous == null) return true;
    return previous.isVisible() == false;
}
项目:VASSAL-src    文件:PieceDefiner.java   
protected boolean edit(int index) {
  Object o = inUseModel.elementAt(index);
  if (!(o instanceof EditablePiece)) {
    return false;
  }
  EditablePiece p = (EditablePiece) o;
  if (p.getEditor() != null) {
    Ed ed = null;
    Window w = SwingUtilities.getWindowAncestor(this);
    if (w instanceof Frame) {
      ed = new Ed((Frame) w, p);
    }
    else if (w instanceof Dialog) {
      ed = new Ed((Dialog) w, p);
    }
    else {
      ed = new Ed((Frame) null, p);
    }
    final String oldState = p.getState();
    final String oldType = p.getType();
    ed.setVisible(true);
    PieceEditor c = ed.getEditor();
    if (c != null) {
      p.mySetType(c.getType());
      if (p instanceof Decorator) {
        ((Decorator) p).mySetState(c.getState());
      }
      else {
        p.setState(c.getState());
      }
      if ((! p.getType().equals(oldType)) || (! p.getState().equals(oldState))) {
        setChanged(true);
      }
      refresh();
      return true;
    }
  }
  return false;
}
项目:jmt    文件:LDStrategyEditor.java   
/**
 * Returns a new instance of LDStrategyEditor, given parent container (used to find
 * top level Dialog or Frame to create this dialog as modal)
 * @param parent any type of container contained in a Frame or Dialog
 * @param strategy LDStrategy to be modified
 * @return new instance of LDStrategyEditor
 */
public static LDStrategyEditor getInstance(Container parent, LDStrategy strategy) {
    // Finds top level Dialog or Frame to invoke correct costructor
    while (!(parent instanceof Frame || parent instanceof Dialog)) {
        parent = parent.getParent();
    }

    if (parent instanceof Frame) {
        return new LDStrategyEditor((Frame) parent, strategy);
    } else {
        return new LDStrategyEditor((Dialog) parent, strategy);
    }
}