Java Code Examples for java.awt.Dialog

The following are top voted examples for showing how to use java.awt.Dialog. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: alevin-svn2   File: MultiAlgoScenarioWizard.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 2
Project: VASSAL-src   File: GenericListener.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Project: incubator-netbeans   File: NotificationLineSupportTest.java   Source Code and License 6 votes vote down vote up
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 ();
}
 
Example 4
Project: jdk8u-jdk   File: JOptionPane.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 5
Project: incubator-netbeans   File: CustomizerLibraries.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 6
Project: incubator-netbeans   File: NodeOperationImpl.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 7
Project: openjdk-jdk10   File: HiDPIPropertiesUnixTest.java   Source Code and License 6 votes vote down vote up
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);
    }
 
Example 8
Project: incubator-netbeans   File: CustomizerProviderImpl.java   Source Code and License 6 votes vote down vote up
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();
            }
        }
 
Example 9
Project: jdk8u-jdk   File: MultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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];
    }
 
Example 10
Project: incubator-netbeans   File: BranchSelector.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 11
Project: incubator-netbeans   File: NbApplicationAdapter.java   Source Code and License 6 votes vote down vote up
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
}
 
Example 12
Project: jdk8u-jdk   File: MissingEventsOnModalDialogTest.java   Source Code and License 6 votes vote down vote up
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);
    }
 
Example 13
Project: incubator-netbeans   File: OutlineView152857Test.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 14
Project: incubator-netbeans   File: TreeTableView152857Test.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 15
Project: incubator-netbeans   File: FileChooserBuilderTest.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 16
Project: incubator-netbeans   File: GetPortMappingsAction.java   Source Code and License 6 votes vote down vote up
@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();
        }
    }
}
 
Example 17
Project: incubator-netbeans   File: LoremIpsumGenerator.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example 18
Project: incubator-netbeans   File: JFXDeploymentPanel.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 19
Project: incubator-netbeans   File: VersioningInfo.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 20
Project: incubator-netbeans   File: JavaHelp.java   Source Code and License 5 votes vote down vote up
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();
    }
}
 
Example 21
Project: rapidminer   File: ButtonDialog.java   Source Code and License 5 votes vote down vote up
/**
 * @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();
}
 
Example 22
Project: incubator-netbeans   File: CertPassphraseDlg.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 23
Project: openjdk-jdk10   File: FocusTransferWDFDocModal1Test.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 24
Project: jmt   File: DefaultsEditor.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
	}
}
 
Example 25
Project: incubator-netbeans   File: HardStringWizardPanel.java   Source Code and License 5 votes vote down vote up
/** 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);
            }
        }
    });
}
 
Example 26
Project: rapidminer   File: BookmarkDialog.java   Source Code and License 5 votes vote down vote up
public BookmarkDialog(Dialog top, boolean modal) {
	super(top, modal);
	try {
		init();
	} catch (Exception ex) {
	}
}
 
Example 27
Project: incubator-netbeans   File: WindowBuilders.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 28
Project: incubator-netbeans   File: ChooseBeanInitializer.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 29
Project: incubator-netbeans   File: DialogSupport.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 30
Project: incubator-netbeans   File: JWSCustomizerPanel.java   Source Code and License 5 votes vote down vote up
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();

}
 
Example 31
Project: incubator-netbeans   File: RemoteTerminalAction.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 32
Project: incubator-netbeans   File: AboutAction.java   Source Code and License 5 votes vote down vote up
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();
        }
    }
}
 
Example 33
Project: incubator-netbeans   File: RevertPanel.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 34
Project: QN-ACTR-Release   File: AboutDialogFactory.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 35
Project: incubator-netbeans   File: ProjectCustomizerListenersTest.java   Source Code and License 5 votes vote down vote up
public Dialog createDialog(DialogDescriptor descriptor) {
    Object[] options = descriptor.getOptions();
    if (options[0] instanceof JButton) {
        ((JButton) options[0]).doClick();
    }
    return new JDialog();
}
 
Example 36
Project: jdk8u-jdk   File: DialogAboveFrameTest.java   Source Code and License 5 votes vote down vote up
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();
    }
}
 
Example 37
Project: incubator-netbeans   File: ExportBundle.java   Source Code and License 5 votes vote down vote up
@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);
        }
    }
}
 
Example 38
Project: incubator-netbeans   File: I18nTestWizardAction.java   Source Code and License 5 votes vote down vote up
/** 
 * 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;
}
 
Example 39
Project: VASSAL-src   File: PieceDefiner.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 40
Project: jmt   File: LDStrategyEditor.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
	}
}
 
Example 41
Project: incubator-netbeans   File: SaveStash.java   Source Code and License 5 votes vote down vote up
boolean show () {
    okButton = new JButton(Bundle.CTL_SaveStash_okButton_text());
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    JButton shelveButton = new JButton(Bundle.CTL_SaveStash_shelveButton_text());
    org.openide.awt.Mnemonics.setLocalizedText(shelveButton, shelveButton.getText());
    Object[] buttons;
    if (roots.length == 0) {
        buttons = new Object[] { okButton, DialogDescriptor.CANCEL_OPTION };
    } else {
        buttons = new Object[] { okButton, shelveButton, DialogDescriptor.CANCEL_OPTION };
    }
    dd = new DialogDescriptor(panel, Bundle.LBL_SaveStash_title(repository.getName()), true,
            buttons, okButton, DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.git.ui.stash.SaveStash"), //NOI18N
            null);
    validate();
    panel.txtMessage.getDocument().addDocumentListener(this);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    if (shelveButton == dd.getValue()) {
        EventQueue.invokeLater(new Runnable() {

            @Override
            public void run () {
                SystemAction.get(ShelveChangesAction.class).shelve(repository, roots);
            }
        });
    }
    return okButton == dd.getValue();
}
 
Example 42
Project: incubator-netbeans   File: PullImageAction.java   Source Code and License 5 votes vote down vote up
@NbBundle.Messages({
    "LBL_Pull=&Pull",
    "LBL_SearchImage=Search Image"
})
@Override
protected void performAction(Node[] activatedNodes) {
    DockerInstance instance = activatedNodes[0].getLookup().lookup(DockerInstance.class);
    if (instance != null) {
        JButton pullButton = new JButton();
        Mnemonics.setLocalizedText(pullButton, Bundle.LBL_Pull());
        DockerHubSearchPanel panel = new DockerHubSearchPanel(instance, pullButton);

        DialogDescriptor descriptor
                = new DialogDescriptor(panel, Bundle.LBL_SearchImage(),
                        true, new Object[]{pullButton, DialogDescriptor.CANCEL_OPTION}, pullButton,
                        DialogDescriptor.DEFAULT_ALIGN, null, null);
        descriptor.setClosingOptions(new Object[]{pullButton, DialogDescriptor.CANCEL_OPTION});
        Dialog dlg = null;

        try {
            dlg = DialogDisplayer.getDefault().createDialog(descriptor);
            dlg.setVisible(true);

            if (descriptor.getValue() == pullButton) {
                perform(instance, panel.getImage());
            }
        } finally {
            if (dlg != null) {
                dlg.dispose();
            }
        }
    }
}
 
Example 43
Project: openjdk-jdk10   File: FocusTransferWDFModeless3Test.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    FocusTransferWDFTest test = new FocusTransferWDFTest(
            Dialog.ModalityType.MODELESS,
            FocusTransferWDFTest.DialogParent.FRAME,
            FocusTransferWDFTest.WindowParent.FRAME);
    test.doTest();
}
 
Example 44
Project: incubator-netbeans   File: I18nWizardAction.java   Source Code and License 5 votes vote down vote up
/** 
 * 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 = dialogWRef.get();
    if (previous == null) return true;
    return previous.isVisible() == false;
}
 
Example 45
Project: incubator-netbeans   File: EventSetPatternPanel.java   Source Code and License 4 votes vote down vote up
void setDialog( Dialog dialog ) {
    this.dialog = dialog;
}
 
Example 46
Project: incubator-netbeans   File: PropertiesAction.java   Source Code and License 4 votes vote down vote up
@Override
protected void performContextAction(Node[] nodes) {
    VCSContext context = HgUtils.getCurrentContext(nodes);
    final File roots[] = HgUtils.getActionRoots(context);
    if (roots == null || roots.length == 0) return;
    final File root = Mercurial.getInstance().getRepositoryRoot(roots[0]);

    final PropertiesPanel panel = new PropertiesPanel();

    final PropertiesTable propTable;

    propTable = new PropertiesTable(panel.labelForTable, PropertiesTable.PROPERTIES_COLUMNS);

    panel.setPropertiesTable(propTable);

    JComponent component = propTable.getComponent();

    panel.propsPanel.setLayout(new BorderLayout());

    panel.propsPanel.add(component, BorderLayout.CENTER);

    HgProperties hgProperties = new HgProperties(panel, propTable, root);        

    DialogDescriptor dd = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_PropertiesDialog_Title", null), true, null); // NOI18N
    JButton okButton =  new JButton();
    org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_Properties_Action_OK"));
    okButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSN_Properties_Action_OK")); // NOI18N
    okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Action_OK")); 
    JButton cancelButton =  new JButton();
    org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_Properties_Action_Cancel"));
    cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSN_Properties_Action_Cancel")); // NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Action_Cancel")); 
    dd.setOptions(new Object[] {okButton, cancelButton});
    dd.setHelpCtx(new HelpCtx(PropertiesAction.class));
    panel.putClientProperty("contentTitle", null);  // NOI18N
    panel.putClientProperty("DialogDescriptor", dd); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Dialog")); // NOI18N
    dialog.pack();
    dialog.setVisible(true);
    if (dd.getValue() == okButton) {
        hgProperties.updateLastSelection();
        hgProperties.setProperties();
    }
}
 
Example 47
Project: incubator-netbeans   File: ActionProviderSupport.java   Source Code and License 4 votes vote down vote up
@NbBundle.Messages({
    "LBL_MainClassWarning_ChooseMainClass_OK=OK",
    "AD_MainClassWarning_ChooseMainClass_OK=N/A",
    "# {0} - project name", "LBL_MainClassNotFound=Project {0} does not have a main class set.",
    "# {0} - name of class", "# {1} - project name", "LBL_MainClassWrong={0} class wasn''t found in {1} project.",
    "CTL_MainClassWarning_Title=Run Project"
    })
static boolean showCustomizer(
        @NonNull final Project project,
        @NonNull final UpdateHelper updateHelper,
        @NonNull final PropertyEvaluator evaluator,
        @NonNull final SourceRoots projectSourceRoots,
        @NonNull final Function<String,ClassPath> classpaths) {
    boolean result = false;
    final JButton okButton = new JButton(LBL_MainClassWarning_ChooseMainClass_OK());
    okButton.getAccessibleContext().setAccessibleDescription(AD_MainClassWarning_ChooseMainClass_OK());
    // main class goes wrong => warning
    String mainClass = getProjectMainClass(project, evaluator, projectSourceRoots, classpaths, false);
    String message;
    if (mainClass == null) {
        message = LBL_MainClassNotFound(ProjectUtils.getInformation(project).getDisplayName());
    } else {
        message = LBL_MainClassWrong(
            mainClass,
            ProjectUtils.getInformation(project).getDisplayName());
    }
    final MainClassWarning panel = new MainClassWarning (message, projectSourceRoots.getRoots());
    Object[] options = new Object[] {
        okButton,
        DialogDescriptor.CANCEL_OPTION
    };
    panel.addChangeListener (new ChangeListener () {
        @Override
       public void stateChanged (ChangeEvent e) {
           if (e.getSource () instanceof MouseEvent && MouseUtils.isDoubleClick (((MouseEvent)e.getSource ()))) {
               // click button and the finish dialog with selected class
               okButton.doClick ();
           } else {
               okButton.setEnabled (panel.getSelectedMainClass () != null);
           }
       }
    });
    okButton.setEnabled (false);
    DialogDescriptor desc = new DialogDescriptor (panel,
        CTL_MainClassWarning_Title(),
        true, options, options[0], DialogDescriptor.BOTTOM_ALIGN, null, null);
    desc.setMessageType (DialogDescriptor.INFORMATION_MESSAGE);
    Dialog dlg = DialogDisplayer.getDefault ().createDialog (desc);
    dlg.setVisible (true);
    if (desc.getValue() == options[0]) {
        mainClass = panel.getSelectedMainClass ();
        String config = evaluator.getProperty(ProjectProperties.PROP_PROJECT_CONFIGURATION_CONFIG);
        String path;
        if (config == null || config.length() == 0) {
            path = AntProjectHelper.PROJECT_PROPERTIES_PATH;
        } else {
            // Set main class for a particular config only.
            path = "nbproject/configs/" + config + ".properties"; // NOI18N
        }
        final EditableProperties ep = updateHelper.getProperties(path);
        ep.put(ProjectProperties.MAIN_CLASS, mainClass == null ? "" : mainClass);
        try {
            if (updateHelper.requestUpdate()) {
                updateHelper.putProperties(path, ep);
                ProjectManager.getDefault().saveProject(project);
                result = true;
            }
        } catch (IOException ioe) {
            Exceptions.printStackTrace(ioe);
        }
    }
    dlg.dispose();
    return result;
}
 
Example 48
Project: swingspy   File: SwingSpy.java   Source Code and License 4 votes vote down vote up
/**
 * Initializes Spy dialog.
 */
protected void initSpyDialog(Component rootComponent, Component component) {
	if (rootComponent instanceof Dialog) {
		spyDialog = new CaddyDialog((Dialog) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else if (rootComponent instanceof Frame) {
		spyDialog = new CaddyDialog((Frame) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else {
		spyDialog = new JDialog() {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	}
	spyDialog.setName("SwingSpy");
	spyDialog.setTitle("SwingSpy");
	spyDialog.setModal(false);
	spyDialog.setAlwaysOnTop(true);
	Container contentPane = spyDialog.getContentPane();
	contentPane.setLayout(new BorderLayout());
	spyPanel = new SwingSpyPanel();
	spyPanel.reload(rootComponent, component);
	contentPane.add(spyPanel);
	spyDialog.pack();

	spyDialog.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			super.windowClosed(e);
			spyGlass.setVisible(false);
			spyDialog = null;
		}
	});
	spyDialog.setLocationRelativeTo(null);
	spyDialog.setVisible(true);
}
 
Example 49
Project: incubator-netbeans   File: PatchAction.java   Source Code and License 4 votes vote down vote up
public ChooserListener(Dialog dialog,JFileChooser chooser){
    super();
    this.dialog = dialog;
    this.chooser = chooser;
}
 
Example 50
Project: openjdk-jdk10   File: ToolkitExcludeFrameFileTest.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    ExcludeFrameTest test = new ExcludeFrameTest(
            Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
            ExcludeFrameTest.DialogToShow.FILE_DIALOG);
    test.doTest();
}
 
Example 51
Project: openjdk-jdk10   File: BlockingFDModelessTest.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    (new BlockingFDTest(Dialog.ModalityType.MODELESS)).doTest();
}
 
Example 52
Project: openjdk-jdk10   File: ToolkitExcludeDialogFileTest.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    ExcludeDialogTest test = new ExcludeDialogTest(
            Dialog.ModalExclusionType.TOOLKIT_EXCLUDE,
            ExcludeDialogTest.DialogToShow.FILE_DIALOG);
    test.doTest();
}
 
Example 53
Project: rapidminer   File: MultiPageDialog.java   Source Code and License 4 votes vote down vote up
public MultiPageDialog(Dialog owner, String key, boolean modal, Object... arguments) {
	super(owner, key, modal ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS, arguments);
}
 
Example 54
Project: incubator-netbeans   File: DefaultDataObjectLookupTest.java   Source Code and License 4 votes vote down vote up
public Dialog createDialog(DialogDescriptor descriptor) {
    throw new IllegalStateException("Not implemented");
}
 
Example 55
Project: openjdk-jdk10   File: ToBackAppModal3Test.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    (new ToBackFDFTest(Dialog.ModalityType.APPLICATION_MODAL,
        ToBackFDFTest.DialogOwner.HIDDEN_FRAME)).doTest();
}
 
Example 56
Project: KernelHive   File: WizardDialog.java   Source Code and License 4 votes vote down vote up
public WizardDialog(Dialog owner, WizardController controller) {
	super(owner);
	this.controller = controller;
	initComponents();
}
 
Example 57
Project: incubator-netbeans   File: NodeOperationImpl.java   Source Code and License 4 votes vote down vote up
SheetNodesListener(Dialog dialog, TopComponent tc) {
    this.dialog = dialog;
    this.tc = tc;
    tc.addPropertyChangeListener(this);
}
 
Example 58
Project: Logisim   File: JDialogOk.java   Source Code and License 4 votes vote down vote up
public JDialogOk(Dialog parent, String title, boolean model) {
	super(parent, title, true);
	configure();
}
 
Example 59
Project: openjdk-jdk10   File: DimensionEncapsulation.java   Source Code and License 4 votes vote down vote up
@Override
public void run() {
    runTest(new Panel());
    runTest(new Button());
    runTest(new Checkbox());
    runTest(new Canvas());
    runTest(new Choice());
    runTest(new Label());
    runTest(new Scrollbar());
    runTest(new TextArea());
    runTest(new TextField());
    runTest(new Dialog(new JFrame()));
    runTest(new Frame());
    runTest(new Window(new JFrame()));
    runTest(new FileDialog(new JFrame()));
    runTest(new List());
    runTest(new ScrollPane());
    runTest(new JFrame());
    runTest(new JDialog(new JFrame()));
    runTest(new JWindow(new JFrame()));
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    //runTest(new JScrollBar()); --> don't test defines max and min in
    // terms of preferred
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
 
Example 60
Project: openjdk-jdk10   File: OnTopDocModal5Test.java   Source Code and License 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    (new OnTopFDFTest(
        Dialog.ModalityType.DOCUMENT_MODAL,
        OnTopFDFTest.DialogOwner.FRAME)).doTest();
}