java.awt.Dialog.ModalExclusionType#java.awt.Dialog源码实例Demo

下面列出了java.awt.Dialog.ModalExclusionType#java.awt.Dialog 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: SplashUISupport.java
/** Creates a new instance of ColorChooser */
public ColorComboBox() {
    super(content);
    setRenderer(new Renderer());
    setEditable(true);
    setEditor(new Renderer());
    setSelectedItem(new Value(null, null));
    addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            if (getSelectedItem() == CUSTOM_COLOR) {
                Color c = JColorChooser.showDialog(
                        SwingUtilities.getAncestorOfClass
                        (Dialog.class, ColorComboBox.this),
                        loc("SelectColor"), // NOI18N
                        null
                        );
                setColor(c);
            }
            ColorComboBox.this.firePropertyChange(PROP_COLOR, null, null);
        }
    });
}
 
源代码2 项目: triplea   文件: PbfSetupPanel.java
private void createComponents() {
  final JScrollPane scrollPane = new JScrollPane(localPlayerPanel);
  localPlayerPanel.addHierarchyListener(
      e -> {
        final Window window = SwingUtilities.getWindowAncestor(localPlayerPanel);
        if (window instanceof Dialog) {
          final Dialog dialog = (Dialog) window;
          if (!dialog.isResizable()) {
            dialog.setResizable(true);
            dialog.setMinimumSize(new Dimension(700, 700));
          }
        }
      });
  localPlayerSelection.addActionListener(
      e ->
          JOptionPane.showMessageDialog(
              PbfSetupPanel.this,
              scrollPane,
              "Select Local Players and AI's",
              JOptionPane.PLAIN_MESSAGE));
}
 
源代码3 项目: jdk8u60   文件: ModalDialogOrderingTest.java
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
源代码4 项目: netbeans   文件: MessageAuthenticationProfile.java
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new MessageAuthentication(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
源代码5 项目: NBANDROID-V2   文件: AndroidCustomizerProvider.java
@Override
public void showCustomizer() {
    Dialog dialog = ProjectCustomizer.createCustomizerDialog(
            //Path to layer folder:
            CUSTOMIZER_FOLDER_PATH,
            //Lookup, which must contain, at least, the Project:
            Lookups.fixed(project),
            //Preselected category:
            "",
            //OK button listener:
            new OKOptionListener(),
            //HelpCtx for Help button of dialog:
            null);
    dialog.setTitle(ProjectUtils.getInformation(project).getDisplayName());
    dialog.setVisible(true);
}
 
源代码6 项目: 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;
}
 
源代码7 项目: openjdk-8-source   文件: 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;
}
 
private static void clickOnDialog(Dialog dialog) {
    try {
        long time = System.currentTimeMillis() + 200;

        while (!dialog.isVisible()) {
            if (time < System.currentTimeMillis()) {
                throw new RuntimeException("Dialog is not visible!");
            }
            Thread.sleep(10);
        }

        Point point = getCenterPoint(dialog);
        Robot robot = new Robot();
        robot.setAutoDelay(50);

        robot.mouseMove(point.x, point.y);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
源代码9 项目: visualvm   文件: ProfilerSessions.java
private static ProfilerFeature selectFeature(Set<ProfilerFeature> features, String actionName) {
    UI ui = UI.selectFeature(features);

    HelpCtx helpCtx = new HelpCtx("SelectFeatureDialog.HelpCtx"); // NOI18N // TODO: should have a special one?
    String caption = actionName == null ? Bundle.ProfilerSessions_selectFeature() : actionName;
    DialogDescriptor dd = new DialogDescriptor(ui, caption, true, new Object[]
                                             { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
                                               DialogDescriptor.OK_OPTION, DialogDescriptor.BOTTOM_ALIGN,
                                               helpCtx, null);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    
    ProfilerFeature ret = dd.getValue() == DialogDescriptor.OK_OPTION ? ui.selectedFeature() : null;
    
    dd.setMessage(null); // Do not leak because of WindowsPopupMenuUI.mnemonicListener
    
    return ret;
}
 
源代码10 项目: 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;
}
 
源代码11 项目: TencentKona-8   文件: ModalDialogOrderingTest.java
public static void main(String[] args) {

        final Frame frame = new Frame("Test");
        frame.setSize(400, 400);
        frame.setBackground(FRAME_COLOR);
        frame.setVisible(true);

        final Dialog modalDialog = new Dialog(null, true);
        modalDialog.setTitle("Modal Dialog");
        modalDialog.setSize(400, 200);
        modalDialog.setBackground(DIALOG_COLOR);
        modalDialog.setModal(true);

        new Thread(new Runnable() {

            @Override
            public void run() {
                runTest(modalDialog, frame);
            }
        }).start();

        modalDialog.setVisible(true);
    }
 
源代码12 项目: netbeans   文件: OutputPanel.java
private void targetsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_targetsButtonActionPerformed
    UndoCounter undoCounter = new UndoCounter();
    model.addUndoableEditListener(undoCounter);

    TargetsPanel targetsPanel = new TargetsPanel(output); //NOI18N
    DialogDescriptor dlgDesc = new DialogDescriptor(targetsPanel, 
            NbBundle.getMessage(InputPanel.class, "LBL_Targets_Panel_Title")); //NOI18N
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
    
    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    } else {
        SecurityPolicyModelHelper.getInstance(PolicyModelHelper.getConfigVersion(binding)).setTargets(output, targetsPanel.getTargetsModel());            
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
源代码13 项目: NBANDROID-V2   文件: SdksCustomizer.java
/**
 * Shows platforms customizer
 *
 * @param platform which should be seelcted, may be null
 * @return boolean for future extension, currently always true
 */
public static boolean showCustomizer() {
    SdksCustomizer customizer
            = new SdksCustomizer();
    javax.swing.JButton close = new javax.swing.JButton(NbBundle.getMessage(SdksCustomizer.class, "CTL_Close"));
    close.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SdksCustomizer.class, "AD_Close"));
    DialogDescriptor descriptor = new DialogDescriptor(customizer, NbBundle.getMessage(SdksCustomizer.class,
            "TXT_PlatformsManager"), true, new Object[]{close}, close, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.nbandroid.netbeans.gradle.v2.sdk.ui.PlatformsCustomizer"), null); // NOI18N
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(descriptor);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
    return true;
}
 
源代码14 项目: netbeans   文件: ApisupportAntUIUtils.java
public static @CheckForNull NbModuleProject runProjectWizard(
        final NewNbModuleWizardIterator iterator, final String titleBundleKey) {
    WizardDescriptor wd = new WizardDescriptor(iterator);
    wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wd.setTitle(NbBundle.getMessage(ApisupportAntUIUtils.class, titleBundleKey));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
    dialog.setVisible(true);
    dialog.toFront();
    NbModuleProject project = null;
    boolean cancelled = wd.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        FileObject folder = iterator.getCreateProjectFolder();
        if (folder == null) {
            return null;
        }
        try {
            project = (NbModuleProject) ProjectManager.getDefault().findProject(folder);
            OpenProjects.getDefault().open(new Project[] { project }, false);
        } catch (IOException e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return project;
}
 
源代码15 项目: netbeans   文件: Selenium2Customizer.java
@NbBundle.Messages("MSG_CONFIGURE=Configure Selenium Server")
public static boolean showCustomizer() {
    Selenium2Customizer panel = new Selenium2Customizer();
    DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.MSG_CONFIGURE());
    panel.setDescriptor(descriptor);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    dialog.setModal(true);
    dialog.setVisible(true);
    dialog.dispose();
    if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
        Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.SELENIUM_SERVER_JAR, panel.tfSeleniumServerJar.getText());
        Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.FIREFOX_PROFILE_TEMPLATE_DIR, panel.tfFirefoxProfileDir.getText());
        Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.USER_EXTENSION_FILE, panel.tfUserExtensionFile.getText());
        Selenium2ServerSupport.getPrefs().putInt(Selenium2ServerSupport.PORT, Integer.parseInt(panel.spinnerPort.getValue().toString()));
        Selenium2ServerSupport.getPrefs().putBoolean(Selenium2ServerSupport.SINGLE_WINDOW, panel.cbSingleWindow.isSelected());
        return true;
    } else {
        return false;
    }
}
 
源代码16 项目: netbeans   文件: MethodExceptionDialog.java
public void showDialog(JComponent invoker) {
    DialogDescriptor dlg = new DialogDescriptor(
            this,
            NbBundle.getMessage(this.getClass(), "CLIENT_EXCEPTION"), // NOI18N
            false,
            NotifyDescriptor.OK_CANCEL_OPTION,
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.DEFAULT_ALIGN,
            HelpCtx.DEFAULT_HELP,
            null);
    dlg.setOptions(new Object[] { okButton });
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dlg);
    dialog.setPreferredSize(new Dimension(500,300));
    dialog.setLocationRelativeTo(invoker);
    dialog.setVisible(true);
}
 
源代码17 项目: lucene-solr   文件: CreateIndexDialogFactory.java
@Override
public JDialog create(Window owner, String title, int width, int height) {
  dialog = new JDialog(owner, title, Dialog.ModalityType.APPLICATION_MODAL);
  dialog.add(content());
  dialog.setSize(new Dimension(width, height));
  dialog.setLocationRelativeTo(owner);
  dialog.getContentPane().setBackground(prefs.getColorTheme().getBackgroundColor());
  return dialog;
}
 
源代码18 项目: marathonv5   文件: WindowTitle.java
private String getTitle(Component component) {
    String title = null;
    if (component instanceof Dialog) {
        title = ((Dialog) component).getTitle();
    } else if (component instanceof Frame) {
        title = ((Frame) component).getTitle();
    }
    return title == null ? "<NoTitle>" : title;
}
 
源代码19 项目: JDKSourceCode1.8   文件: JFileChooser.java
/**
 * Creates and returns a new <code>JDialog</code> wrapping
 * <code>this</code> centered on the <code>parent</code>
 * in the <code>parent</code>'s frame.
 * This method can be overriden to further manipulate the dialog,
 * to disable resizing, set the location, etc. Example:
 * <pre>
 *     class MyFileChooser extends JFileChooser {
 *         protected JDialog createDialog(Component parent) throws HeadlessException {
 *             JDialog dialog = super.createDialog(parent);
 *             dialog.setLocation(300, 200);
 *             dialog.setResizable(false);
 *             return dialog;
 *         }
 *     }
 * </pre>
 *
 * @param   parent  the parent component of the dialog;
 *                  can be <code>null</code>
 * @return a new <code>JDialog</code> containing this instance
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
 * returns true.
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @since 1.4
 */
protected JDialog createDialog(Component parent) throws HeadlessException {
    FileChooserUI ui = getUI();
    String title = ui.getDialogTitle(this);
    putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY,
                      title);

    JDialog dialog;
    Window window = JOptionPane.getWindowForComponent(parent);
    if (window instanceof Frame) {
        dialog = new JDialog((Frame)window, title, true);
    } else {
        dialog = new JDialog((Dialog)window, title, true);
    }
    dialog.setComponentOrientation(this.getComponentOrientation());

    Container contentPane = dialog.getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(this, BorderLayout.CENTER);

    if (JDialog.isDefaultLookAndFeelDecorated()) {
        boolean supportsWindowDecorations =
        UIManager.getLookAndFeel().getSupportsWindowDecorations();
        if (supportsWindowDecorations) {
            dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
        }
    }
    dialog.pack();
    dialog.setLocationRelativeTo(parent);

    return dialog;
}
 
源代码20 项目: BART   文件: ChartsPanel.java
private Dialog createDialog(JPanel inner, String title)   {
    final Dialog d = new ChartDialog(inner, title);
    d.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosed(WindowEvent e) {
            dialogs.remove(d);
        }
        
    });
    return d;
}
 
源代码21 项目: wildfly-core   文件: ListEditor.java
public ListEditor(Dialog parent) {
    this.parent = parent;
    list.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setPrototypeCellValue("012345678901234567890123456789"); // about 30 characters wide
    list.addListSelectionListener(this);

    JPanel buttonColumn = makeButtonColumn();

    JScrollPane scroller = new JScrollPane(list);
    JPanel moveUpDownColumn = makeMoveUpDownColumn();


    setLayout(new GridBagLayout());
    GridBagConstraints gbConst = new GridBagConstraints();

    gbConst.gridx = 0;
    gbConst.weightx = 1.0;
    gbConst.weighty = 1.0;
    add(buttonColumn, gbConst);

    add(Box.createHorizontalStrut(5));

    gbConst.fill = GridBagConstraints.BOTH;
    gbConst.gridx = GridBagConstraints.RELATIVE;
    gbConst.weightx = 10.0;
    add(scroller, gbConst);

    add(Box.createHorizontalStrut(5));

    gbConst.fill = GridBagConstraints.NONE;
    gbConst.weightx = 1.0;
    add(moveUpDownColumn, gbConst);
}
 
源代码22 项目: opensim-gui   文件: DialogUtils.java
public static void addCloseButton(Dialog dDialog, ActionListener actionListener) {
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createRigidArea(new Dimension(50, 50)));
    buttonPanel.add(Box.createVerticalStrut(50));
    buttonPanel.add(Box.createGlue());
    dDialog.add(buttonPanel, BorderLayout.SOUTH);
    JButton closeButton = new JButton("Close");
    buttonPanel.add(closeButton);
    closeButton.addActionListener(actionListener);
    dDialog.doLayout();
    dDialog.pack();
}
 
源代码23 项目: netbeans   文件: BindingPanel.java
private void trustButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trustButtonActionPerformed
    String profile = (String) profileCombo.getSelectedItem();
    TruststorePanel storePanel = new TruststorePanel(binding, project, jsr109, profile, false, getUserExpectedConfigVersion());
    DialogDescriptor dlgDesc = new DialogDescriptor(storePanel,
            NbBundle.getMessage(BindingPanel.class, "LBL_Truststore_Panel_Title")); //NOI18N
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true);
    if (dlgDesc.getValue() == DialogDescriptor.OK_OPTION) {
        storePanel.storeState();
    }
}
 
源代码24 项目: jdk8u60   文件: ImageableAreaTest.java
private static void createAndShowTestDialog(String description,
        String failMessage, Runnable action) {
    final JDialog dialog = new JDialog();
    dialog.setTitle("Test: " + (++testCount));
    dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    JTextArea textArea = new JTextArea(description);
    textArea.setEditable(false);
    final JButton testButton = new JButton("Print Table");
    final JButton passButton = new JButton("PASS");
    passButton.setEnabled(false);
    passButton.addActionListener((e) -> {
        dialog.dispose();
    });
    final JButton failButton = new JButton("FAIL");
    failButton.setEnabled(false);
    failButton.addActionListener((e) -> {
        throw new RuntimeException(failMessage);
    });
    testButton.addActionListener((e) -> {
        testButton.setEnabled(false);
        action.run();
        passButton.setEnabled(true);
        failButton.setEnabled(true);
    });
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(textArea, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel(new FlowLayout());
    buttonPanel.add(testButton);
    buttonPanel.add(passButton);
    buttonPanel.add(failButton);
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    dialog.add(mainPanel);
    dialog.pack();
    dialog.setVisible(true);
}
 
public synchronized void notifyChangeRequest(Component comp) {
    if (!(comp instanceof Frame || comp instanceof Dialog))
        return;

    // if busy with the current request, ignore this request.
    if (requestComponent != null)
        return;

    requestComponent = comp;
    notify();
}
 
源代码26 项目: netbeans   文件: CreateSampleDBAction.java
public void performAction() {
    if (!Util.checkInstallLocation()) {
        return;
    }
    if (!Util.ensureSystemHome()) {
        return;
    }
    
    String derbySystemHome = DerbyOptions.getDefault().getSystemHome();
    CreateSampleDatabasePanel panel = new CreateSampleDatabasePanel(derbySystemHome);
    DialogDescriptor desc = new DialogDescriptor(panel, NbBundle.getMessage(CreateSampleDBAction.class, "LBL_CreateSampleDatabaseTitle"), true, null);
    desc.createNotificationLineSupport();
    panel.setDialogDescriptor(desc);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(desc);
    panel.setIntroduction();
    String acsd = NbBundle.getMessage(CreateSampleDBAction.class, "ACSD_CreateDatabaseAction");
    dialog.getAccessibleContext().setAccessibleDescription(acsd);
    dialog.setVisible(true);
    dialog.dispose();
    
    if (!DialogDescriptor.OK_OPTION.equals(desc.getValue())) {
        return;
    }
    
    String databaseName = panel.getDatabaseName();
    
    try {
        DerbyDatabasesImpl.getDefault().createSampleDatabase(databaseName, true);
    } catch (Exception e) {
        LOG.log(Level.INFO, null, e);
        LOG.log(Level.INFO, "", e);
        NotifyDescriptor nd = new NotifyDescriptor.Message(
                "Failed to ceate sample database:\n"
                + e.getLocalizedMessage(),
                NotifyDescriptor.ERROR_MESSAGE);
        DialogDisplayer.getDefault().notifyLater(nd);
    }
}
 
源代码27 项目: pumpernickel   文件: PreferencePanel.java
/** Show the component associated with a particular button. */
public void show(AbstractButton button) {
	if (selectedButton == button)
		return;

	selectedButton = button;

	String title = defaultTitle;
	if (selectedButton != homeButton) {
		title = selectedButton.getText();
	}
	Window w = SwingUtilities.getWindowAncestor(this);
	if (w instanceof Dialog) {
		((Dialog) w).setTitle(title);
	} else if (w instanceof Frame) {
		((Frame) w).setTitle(title);
	}

	if (navigationStack.get(navigationPtr) != button) {
		while (navigationStack.size() > navigationPtr + 1) {
			navigationStack.remove(navigationStack.size() - 1);
		}
		navigationStack.add(button);
		navigationPtr = navigationStack.size() - 1;
	}
	repack();
}
 
源代码28 项目: hottub   文件: Util.java
public static void clickOnTitle(final Window decoratedWindow, final Robot robot) {
    if (decoratedWindow instanceof Frame || decoratedWindow instanceof Dialog) {
        Point p = getTitlePoint(decoratedWindow);
        robot.mouseMove(p.x, p.y);
        robot.delay(50);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        robot.delay(50);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    }
}
 
源代码29 项目: openjdk-jdk8u   文件: NpeOnCloseTest.java
public static void main(String[] args)
{
    Frame frame1 = new Frame("frame 1");
    frame1.setBounds(0, 0, 100, 100);
    frame1.setVisible(true);
    Util.waitForIdle(null);

    Frame frame2 = new Frame("frame 2");
    frame2.setBounds(150, 0, 100, 100);
    frame2.setVisible(true);
    Util.waitForIdle(null);

    Frame frame3 = new Frame("frame 3");
    final Dialog dialog = new Dialog(frame3, "dialog", true);
    dialog.setBounds(300, 0, 100, 100);
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                dialog.setVisible(true);
            }
        });
    try {
        EventQueue.invokeAndWait(new Runnable() { public void run() {} });
        Util.waitForIdle(null);
        EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    dialog.dispose();
                }
            });
    }
    catch (InterruptedException ie) {
        throw new RuntimeException(ie);
    }
    catch (InvocationTargetException ite) {
        throw new RuntimeException(ite);
    }

    frame1.dispose();
    frame2.dispose();
    frame3.dispose();
}
 
源代码30 项目: netbeans   文件: SelectionPanel.java
/**
 * Shows the edit panel.
 */
@org.netbeans.api.annotations.common.SuppressWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ",
        justification = "Comparing instances is OK here")
@NbBundle.Messages({
    "SelectionPanel.editDialog.title=Edit Library",
    "SelectionPanel.editDialog.update=Update",
    "SelectionPanel.editDialog.cancel=Cancel"
})
private void showEditPanel() {
    int selectedRow = librariesTable.getSelectedRow();
    Library.Version selectedVersion = libraries.get(selectedRow);
    Library library = libraryInfo.get(selectedVersion.getLibrary().getName());
    EditPanel editPanel = new EditPanel(library, selectedVersion);
    String update = Bundle.SelectionPanel_editDialog_update();
    String cancel = Bundle.SelectionPanel_editDialog_cancel();
    DialogDescriptor descriptor = new DialogDescriptor(
            editPanel,
            Bundle.SelectionPanel_editDialog_title(),
            true,
            new Object[] { update, cancel },
            update,
            DialogDescriptor.DEFAULT_ALIGN,
            HelpCtx.DEFAULT_HELP,
            null
    );
    Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
    dialog.setVisible(true);
    if (descriptor.getValue() == update) {
        Library.Version version = editPanel.getSelection();
        if (version == null) {
            removeSelectedLibraries();
        } else {
            addLibrary(version);
        }
    }
}
 
 同类方法