public SQLQueryBuilder(Window owner, DatabaseHandler databaseHandler) { super(owner, "build_sql_query", ModalityType.APPLICATION_MODAL, new Object[0]); this.tableList = new JList(new DefaultListModel()); this.attributeList = new JList(new DefaultListModel()); this.whereTextArea = new JTextArea(4, 15); this.sqlQueryTextArea = new SQLEditor(); this.surroundingDialog = null; this.connectionStatus = new JLabel(); this.gridPanel = new JPanel(createGridLayout(1, 3)); this.attributeNameMap = new LinkedHashMap(); this.databaseHandler = databaseHandler; this.cache = TableMetaDataCache.getInstance(); if(!"false".equals(ParameterService.getParameterValue("rapidminer.gui.fetch_data_base_table_names"))) { try { this.retrieveTableNames(); } catch (SQLException var4) { SwingTools.showSimpleErrorMessage("db_connection_failed_simple", var4, new Object[0]); this.databaseHandler = null; } } }
public static void showMacroEditorDialog(final ProcessContext context) { ButtonDialog dialog = new ButtonDialog(ApplicationFrame.getApplicationFrame(), "define_macros", ModalityType.APPLICATION_MODAL, new Object[] {}) { private static final long serialVersionUID = 2874661432345426452L; { MacroEditor editor = new MacroEditor(false); editor.setBorder(createBorder()); JButton addMacroButton = new JButton(editor.ADD_MACRO_ACTION); JButton removeMacroButton = new JButton(editor.REMOVE_MACRO_ACTION); layoutDefault(editor, NORMAL, addMacroButton, removeMacroButton, makeOkButton()); } @Override protected void ok() { super.ok(); } }; dialog.setVisible(true); }
public LicenseUpgradeDialog(ResourceAction action, boolean isDowngradeInformation, String key, boolean modal, boolean forceLicenseInstall, boolean useResourceAction, int size, Object... arguments) { super(ApplicationFrame.getApplicationFrame(), key, modal?ModalityType.APPLICATION_MODAL:ModalityType.MODELESS, arguments); this.setResizable(false); this.action = action; this.useResourceAction = useResourceAction; if(arguments.length < 2) { throw new IllegalArgumentException("You need to specify at least the name and the edition of the product that needs to be upgraded."); } else { this.setModal(modal); this.productName = String.valueOf(arguments[0]); this.productEdition = isDowngradeInformation?String.valueOf(arguments[2]):String.valueOf(arguments[1]); this.layoutDefault(this.makeButtonPanel(), size, new AbstractButton[0]); if(forceLicenseInstall) { this.setDefaultCloseOperation(0); } } }
/** * Show a dialog with whois data for the given point * @param parent * @param whois * @param point */ public static void showWhoIsDialog(final JComponent parent, final ServiceFactory services, final GeoPoint point) { final WhoIsPanel panel = new WhoIsPanel(services); final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(parent), "Who is " + point.getIp(), ModalityType.APPLICATION_MODAL) { private static final long serialVersionUID = 1258611715478157956L; @Override public void dispose() { panel.dispose(); super.dispose(); } }; dialog.getContentPane().add(panel, BorderLayout.CENTER); final JPanel bottom = new JPanel(); final JButton close = new JButton(Resources.getLabel("close.button")); close.addActionListener(e -> dialog.dispose()); bottom.add(close); dialog.getContentPane().add(bottom, BorderLayout.SOUTH); services.getWhois().whoIs(point.getIp()); SwingUtilities4.setUp(dialog); dialog.setVisible(true); }
public ContentPaneBuilderUsingDialogConfiguration( final IPreferences preferences, final IMessage message, final IContentPaneBuilder contentPaneBuilder, final DialogType dialogType) { super( preferences, true, message, net.anwiba.commons.swing.icon.GuiIcons.EMPTY_ICON, DataState.UNKNOWN, ModalityType.APPLICATION_MODAL, dialogType, true, new ObjectModel<Void>()); this.contentPaneBuilder = contentPaneBuilder; }
static public JDialog getHelpDialog( Window owner, String title, Class<?> resourceClass, String resourceName) { JDialog helpDialog = new JDialog(owner, title, ModalityType.MODELESS); helpDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); String helpText = getHelpText(resourceClass, resourceName); JLabel label = new JLabel(helpText); label.setBackground(PALE_YELLOW); label.setOpaque(true); JScrollPane contentPane = new JScrollPane(label); contentPane.setBorder( BorderFactory.createCompoundBorder(new LineBorder(Color.BLUE), new EmptyBorder(4, 4, 4, 4))); helpDialog.setContentPane(contentPane); helpDialog.pack(); return helpDialog; }
private void openHeroEditor(HearthStoneDb db) { if (uiAgent == null) { return; } HeroEditorPanel panel = new HeroEditorPanel(db, uiAgent); Window parent = SwingUtilities.getWindowAncestor(this); JDialog mainFrame = new JDialog(parent, "Hero Editor", ModalityType.DOCUMENT_MODAL); mainFrame.getContentPane().setLayout(new GridLayout(1, 1)); mainFrame.getContentPane().add(panel); mainFrame.pack(); mainFrame.setLocationRelativeTo(null); mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); mainFrame.setVisible(true); }
/** * Setting up the user interface */ private void initUI() { pb = new JProgressBar(JProgressBar.HORIZONTAL, value, maxValue == -1 ? 0 : maxValue); pb.setStringPainted(Boolean.TRUE); pb.setIndeterminate(indeterminate); dialog = new JDialog(); dialog.setTitle(title); dialog.setModalityType(ModalityType.MODELESS); dialog.setIconImage(null); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.add(pb); dialog.setSize(this.width, this.height); dialog.setLocationRelativeTo(null); dialog.setVisible(Boolean.TRUE); animationThread().start(); }
public void showPostById(int id, java.awt.Component dialogParent){ JOptionPane optionPane = new JOptionPane(Localization.format("retrieval_format", String.valueOf(id)), JOptionPane.INFORMATION_MESSAGE); JButton button = new JButton(Localization.getString("cancel")); optionPane.setOptions(new Object[]{button}); JDialog dialog = optionPane.createDialog(dialogParent, Localization.getString("retrieving")); button.addActionListener(event -> dialog.dispose()); dialog.setModalityType(ModalityType.MODELESS); dialog.setVisible(true); executor.execute(() -> { List<Post> searchPosts = mapi.listPosts(1, 1, "id:" + id); SwingUtilities.invokeLater(() -> { if (dialog.isDisplayable()){ dialog.dispose(); if (!searchPosts.isEmpty()){ showPostFrame.showPost(searchPosts.get(0)); }else{ JOptionPane.showMessageDialog(null, Localization.getString("id_doesnot_exists"), Localization.getString("error"), JOptionPane.ERROR_MESSAGE); } } }); }); }
@Override public void actionPerformed(final ActionEvent e) { final String rawFilepath = PathsAndFiles.JAVA_POLICY.getFullPath(); String filepath; try { filepath = new URL(rawFilepath).getPath(); } catch (final MalformedURLException mfue) { filepath = null; } if (policyEditorWindow == null || policyEditorWindow.getPolicyEditor().isClosed()) { policyEditorWindow = PolicyEditor.getPolicyEditorDialog(filepath); policyEditorWindow.getPolicyEditor().openPolicyFileSynchronously(); } else { policyEditorWindow.asWindow().toFront(); policyEditorWindow.asWindow().repaint(); } policyEditorWindow.setModalityType(ModalityType.DOCUMENT_MODAL); policyEditorWindow.getPolicyEditor().addNewEntry(new PolicyIdentifier(null, Collections.<PolicyParser.PrincipalEntry>emptySet(), file.getCodeBase().toString())); policyEditorWindow.asWindow().setVisible(true); menu.setVisible(false); }
protected void layoutDialog() { Dialog.getInstance().initLaf(); ModalityType modality = this.getModalityType(); if (this.isCallerIsEDT()) { modality = ModalityType.APPLICATION_MODAL; } this.dialog = new InternDialog<T>(this, modality); if (this.preferredSize != null) { this.dialog.setPreferredSize(this.preferredSize); } this.timerLbl = new JLabel(TimeFormatter.formatMilliSeconds(this.getCountdown(), 0)); this.timerLbl.setEnabled(this.isCountdownPausable()); }
private void separateToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_separateToggleButtonActionPerformed if (separateToggleButton.isSelected()) { lensDialog = new JDialog(SwingUtilities.getWindowAncestor(this), ModalityType.MODELESS); lensDialog.setTitle("Lens"); contentSplitPane.remove(lensPanel); lensDialog.getContentPane().setLayout(new BorderLayout()); lensDialog.getContentPane().add(lensPanel, BorderLayout.CENTER); lensDialog.setSize(400, 400); lensDialog.setLocationRelativeTo(null); lensDialog.setVisible(true); } else { lensDialog.getContentPane().remove(lensPanel); lensDialog.dispose(); contentSplitPane.setBottomComponent(lensPanel); } }
private void build() { this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e){ dialog.dispose(); } }); session = HibernateUtil.instance().openSession(); this.setModalityType(ModalityType.TOOLKIT_MODAL); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); }
static public JDialog addModelessWindow(Window mainWindow, Component jpanel, String title) { JDialog dialog; if (mainWindow != null) { dialog = new JDialog(mainWindow, title); } else { dialog = new JDialog(); dialog.setTitle(title); } dialog.getContentPane().setLayout(new BorderLayout()); dialog.getContentPane().add(jpanel, BorderLayout.CENTER); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.pack(); dialog.setLocationRelativeTo(mainWindow); dialog.setModalityType(ModalityType.MODELESS); dialog.setSize(jpanel.getPreferredSize()); dialog.setVisible(true); return dialog; }
public static File showDialog(boolean sb2, boolean apuc, boolean save) { loading.setLocationRelativeTo(IdeFrame.instance); loading.setVisible(true); loading.paint(loading.getGraphics()); // so much hax // too lazy to get this off the EDT JDialog d = new JDialog(); d.setModalityType(ModalityType.APPLICATION_MODAL); SavePanel p = new SavePanel(sb2, save, apuc, d); d.setContentPane(new JPanel(new BorderLayout())); d.getContentPane().add(p, BorderLayout.CENTER); d.pack(); d.setLocationRelativeTo(p); loading.setVisible(false); d.setVisible(true); return p.selected; }
@Override public void actionEvent(ActionEvent e) { final FilterDialog dlg = new FilterDialog(null, ModalityType.APPLICATION_MODAL); dlg.setFilter(filter); dlg.setVisible(true); if (dlg.isAccepted()) { filteredModel.update(); try { filter.toConfig(Config.getInstance(), configPrefix + "filter"); Config.getInstance().save(); } catch (Exception ex) { Dialogs.showExceptionDialog(ex, I18n.getMessage("Error.saveFilter")); } } filterButton.setSelected(filter.isEnabled()); }
@Override public double[] doAIFCalculation() { aif.manager.setName("AIF ROIs"); aif.manager.setVisible(true); JOptionPane jo = new JOptionPane( "Have you selected your own ROIs?\nSelect the ROIs you want to use" + " and click OK", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null); jo.setEnabled(true); JDialog dialog2 = jo.createDialog("AIF Validation"); dialog2.setModalityType(ModalityType.DOCUMENT_MODAL); dialog2.setVisible(true); return MathAIF.getAIF(voxelsROI(voxels), true); }
public void actionPerformed(ActionEvent e) { if(DatabaseService.checkCommercialDatabaseConstraint("jdbc.manage_drivers") == null) { DriverInfo[] drivers = DatabaseService.getAllDriverInfos(); JDBCDriverTable driverTable = new JDBCDriverTable(drivers); driverTable.setBorder((Border)null); JScrollPane driverTablePane = new JScrollPane(driverTable); driverTablePane.setBorder((Border)null); ButtonDialogBuilder builder = new ButtonDialogBuilder("jdbc_drivers"); ButtonDialog dialog = builder.setOwner(ApplicationFrame.getApplicationFrame()).setModalityType(ModalityType.APPLICATION_MODAL).setContent(driverTablePane, 1).setButtons(new DefaultButtons[]{DefaultButtons.CLOSE_BUTTON}).build(); dialog.setVisible(true); } }
/** * Builds and layouts the configured {@link ImportWizard} dialog. * * @param owner * the dialog owner * @return the new {@link ImportWizard} instance */ public ImportWizard build(Window owner) { DataImportWizard wizard = new DataImportWizard(owner, ModalityType.DOCUMENT_MODAL, null); // add common steps TypeSelectionStep typeSelectionStep = new TypeSelectionStep(wizard); wizard.addStep(typeSelectionStep); wizard.addStep(new LocationSelectionStep(wizard)); wizard.addStep(new StoreToRepositoryStep(wizard)); wizard.addStep(new ConfigureDataStep(wizard)); // check whether a local file data source was specified if (localFileDataSourceFactory != null) { setDataSource(wizard, localFileDataSourceFactory, localFileDataSourceFactory.createNew(wizard, filePath, fileDataSourceFactory)); } // Start with type selection String startingStep = typeSelectionStep.getI18NKey(); // unless another starting step ID is specified if (startingStepID != null) { startingStep = startingStepID; } wizard.layoutDefault(ButtonDialog.HUGE, startingStep); return wizard; }
public OnboardingDialog(WelcomeType welcomeType) { super(ApplicationFrame.getApplicationFrame(), "onboarding", ModalityType.APPLICATION_MODAL, new Object[0]); this.sharedObjects = new HashedMap(); this.cardPool = new HashedMap(); this.welcomeType = WelcomeType.FIRST_WELCOME; this.reminderType = ReminderType.REMINDER; this.welcomeType = welcomeType; this.initGUI(); }
public OnboardingDialog(ReminderType reminderType) { super(ApplicationFrame.getApplicationFrame(), "onboarding", ModalityType.APPLICATION_MODAL, new Object[0]); this.sharedObjects = new HashedMap(); this.cardPool = new HashedMap(); this.welcomeType = WelcomeType.FIRST_WELCOME; this.reminderType = ReminderType.REMINDER; this.welcomeType = WelcomeType.WELCOME_REMINDER; this.reminderType = reminderType; this.initGUI(); }
public LicenseEnteringDialog(Window owner, String key, Object... arguments) { super(owner, key, ModalityType.APPLICATION_MODAL, arguments); this.textArea = new JTextArea(); this.statusLabel = new JLabel(); this.startDateLabel = new JLabel(); this.expirationDateLabel = new JLabel(); this.registeredToLabel = new JLabel(); this.productLabel = new JLabel(); this.editionLabel = new JLabel(); this.parseError = true; if(arguments.length > 0) { this.productName = String.valueOf(arguments[0]); } this.mainPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = 1; c.gridx = 0; c.gridy = 0; this.detailsPanel = this.makeDetailsPanel(); this.mainPanel.add(this.detailsPanel, c); this.textPane = this.makeTextPane(""); c.gridy = 1; c.insets = new Insets(10, 0, 0, 0); this.mainPanel.add(this.textPane, c); this.installButton = this.makeInstallButton(); PromptSupport.setForeground(Color.GRAY, this.textArea); PromptSupport.setPrompt(I18N.getGUILabel("license.paste_here", new Object[0]), this.textArea); PromptSupport.setFontStyle(Integer.valueOf(2), this.textArea); PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT, this.textArea); this.textArea.setText(this.getLicenseKeyFromClipboard()); this.setValuesForDetailsPanel(); this.layoutDefault(this.mainPanel, this.makeButtonPanel()); this.setResizable(false); }
public LicenseDialog(Object... arguments) { super(ApplicationFrame.getApplicationFrame(), "license_dialog", ModalityType.APPLICATION_MODAL, arguments); this.addWindowListener(this.windowListener); ProductConstraintManager.INSTANCE.registerLicenseManagerListener(this.licenseManagerListener); this.activeLicenses = LicenseManagerRegistry.INSTANCE.get().getAllActiveLicenses(); this.setResizable(false); this.setLayout(new BorderLayout()); this.contentPanel = new LicenseContentPanel(this.activeLicenses); this.contentPanel.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent event) { if(event.getEventType() == EventType.ACTIVATED && event.getURL() != null) { try { RMUrlHandler.browse(event.getURL().toURI()); } catch (IOException | URISyntaxException var3) { LicenseDialog.LOGGER.log(Level.SEVERE, "Failed to parse URL for My Account page.", var3); } } } }); final JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(this.contentPanel.getPreferredSize()); scrollPane.getViewport().add(this.contentPanel); this.add(scrollPane, "Center"); SwingUtilities.invokeLater(new Runnable() { public void run() { scrollPane.getVerticalScrollBar().setValue(0); } }); JPanel buttonPanel = this.makeButtonPanel(); buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.DARK_GRAY)); this.add(buttonPanel, "South"); this.pack(); this.setLocationRelativeTo(RapidMinerGUI.getMainFrame()); }
public PendingPurchasesInstallationDialog(List<String> packages) { super(ApplicationFrame.getApplicationFrame(), "purchased_not_installed", ModalityType.MODELESS, new Object[0]); this.purchasedModel = new PendingPurchasesInstallationDialog.PurchasedNotInstalledModel(this.packageDescriptorCache); this.neverAskAgain = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.purchased_not_installed.not_check_on_startup", new Object[0])); this.packages = packages; this.remindNeverButton = this.remindNeverButton(); this.remindLaterButton = this.remindLaterButton(); this.okButton = this.makeOkButton("install_purchased"); this.layoutDefault(this.makeContentPanel(), 1, new AbstractButton[]{this.okButton, this.remindNeverButton, this.remindLaterButton}); this.setPreferredSize(new Dimension(404, 430)); this.setMaximumSize(new Dimension(404, 430)); this.setMinimumSize(new Dimension(404, 300)); this.setSize(new Dimension(404, 430)); }
/** * * @return */ public int showModalDialog() { dialog.setModalityType(ModalityType.APPLICATION_MODAL); dialog.pack(); dialog.setVisible(true); return returnCode; }
/** * * @return */ public int showNonModalDialog(){ dialog.setModalityType(ModalityType.MODELESS); dialog.pack(); dialog.setVisible(true); return returnCode; }
@Override public JDialog makeDialog() { if (container != null) return container; setMessageType(JOptionPane.INFORMATION_MESSAGE); setMessage(makeProgressPanel()); setOptions(new Object[]{"Stop"}); addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) { requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); } } }); container = new JDialog(null, "Hello", ModalityType.MODELESS); container.setResizable(false); container.setLocationRelativeTo(null); container.add(this); this.updateUI(); container.pack(); container.setMinimumSize(container.getPreferredSize()); container.setVisible(true); container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); container.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?"); } }); return container; }
public AbstractDialogConfiguration( final IPreferences preferences, final Dimension preferdSize, final boolean isMessagePanelEnabled, final String title, final IMessage message, final IGuiIcon icon, final IGuiIcon image, final ModalityType modality, final DialogType dialogType, final IFunction<String, String, RuntimeException> actionButtonTextFactory, final boolean isResizeable, final int dialogCloseKeyEvent, final List<IAdditionalActionFactory> additionalActionFactories) { this.preferdSize = preferdSize; this.title = title; this.image = image; this.actionButtonTextFactory = actionButtonTextFactory; this.dialogCloseKeyEvent = dialogCloseKeyEvent; this.additionalActionFactories.addAll(additionalActionFactories); this.windowPreferences = new WindowPreferences(preferences.node(PREFERENCE_NODE_NAME)); this.message = message; this.icon = icon; this.modality = modality; this.dialogType = dialogType; this.isMessagePanelEnabled = isMessagePanelEnabled; this.isResizeable = isResizeable; }
public DialogConfiguration( final IPreferences preferences, final Dimension preferdSize, final boolean isMessagePanelEnabled, final String title, final IMessage message, final IGuiIcon icon, final IGuiIcon image, final ModalityType modality, final DialogType dialogType, final IFunction<String, String, RuntimeException> actionButtonTextFactory, final boolean isResizeable, final int dialogCloseKeyEvent, final List<IAdditionalActionFactory> additionalActionFactories, final IContentPaneBuilder contentPaneBuilder) { super( preferences, preferdSize, isMessagePanelEnabled, title, message, icon, image, modality, dialogType, actionButtonTextFactory, isResizeable, dialogCloseKeyEvent, additionalActionFactories); this.contentPaneBuilder = contentPaneBuilder; }
public AbstractContentPaneBuilderUsingDialogConfiguration( final IPreferences preferences, final boolean isMessagePanelEnabled, final IMessage message, final IGuiIcon icon, final DataState dataState, final ModalityType modality, final DialogType dialogType, final boolean isResizeable, final IObjectModel<T> model) { super( preferences, null, isMessagePanelEnabled, message.getText(), message, icon, null, modality, dialogType, s -> s, isResizeable, KeyEvent.KEY_LOCATION_UNKNOWN, new ArrayList<>()); this.preferences = preferences; this.dataState = dataState; this.model = model; }
@Override public JDialog makeDialog() { if (container != null) { return container; } setMessageType(JOptionPane.INFORMATION_MESSAGE); setMessage(makeProgressPanel()); setOptions(new Object[] { "Stop" }); addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) { requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); } } }); container = new JDialog(null, "Hello", ModalityType.MODELESS); container.setResizable(false); container.setLocationRelativeTo(null); container.add(this); this.updateUI(); container.pack(); container.setMinimumSize(container.getPreferredSize()); container.setVisible(true); container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); container.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?"); } }); return container; }
@SuppressWarnings("unchecked") public void managePresets() { Preset<T> selected = (Preset<T>) presetCombo.getSelectedItem(); PresetManagerDialog<T> dlg = new PresetManagerDialog<>(dialogOwner, presetManager); dlg.setModalityType(ModalityType.APPLICATION_MODAL); GUI.centerAndSizeToParent(dlg, dialogOwner); dlg.setVisible(true); presetCombo.removeAllItems(); List<Preset<T>> presets = presetManager.list(); boolean haveOldSelection = false; for (Preset<T> p : presets) { presetCombo.addItem(p); if (p == selected) { haveOldSelection = true; } } if (haveOldSelection) { presetCombo.setSelectedItem(selected); } else { presetCombo.setSelectedIndex(0); } }
private void openLocationDialog(Geocache g) { LocationDialog ld = new LocationDialog(this); if (g != null) ld.setGeocache(g); ld.setLocationRelativeTo(THIS); ld.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); ld.setVisible(true); if (ld.modified) { updateLocationCombobox(); propagateSelectedLocationComboboxEntry(); } }
public static void actionWithWaitDialog(final Runnable task, Component parent) { final WaitDialog wait = new WaitDialog(); ; wait.setModalityType(ModalityType.APPLICATION_MODAL); wait.setLocationRelativeTo(parent); new Thread(new Runnable() { public void run() { while (!wait.isVisible()) { try { Thread.sleep(25); } catch (InterruptedException e) { } } task.run(); wait.setVisible(false); } }).start(); wait.setVisible(true); wait.repaint(); }
public static void startEditorDialog(JComponent comp, String title, KdxPreference<?> pref) { KdxplorePreferenceEditor editor = new KdxplorePreferenceEditor(title); editor.preferenceTreePanel.setInitialPreference(pref); JDialog dlg = new JDialog(GuiUtil.getOwnerWindow(comp), title, ModalityType.APPLICATION_MODAL); dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dlg.setContentPane(editor.getJPanel()); dlg.pack(); dlg.setVisible(true); }
FieldDimensionsDialog(Window owner, String title){ super(owner, title, ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setContentPane(new JLabel("<HTML>Will prompt for" + "<br>Inter-row Spacing" + "<br>Row Length" + "<br>Alley Length" )); pack(); }
/** * expanded dialog is used to keep the expanded panel on top of all other * windows * * @return the expanded dialog containing the expanded panel */ private JDialog getExpandedDialog() { if (this.expandedDialog == null) { this.expandedDialog = new JDialog( SwingUtilities.getWindowAncestor(this.getGui()), "expanded message console"); this.expandedDialog.add(new JScrollPane(this.getExpandedPanel())); this.expandedDialog.setModalityType(ModalityType.MODELESS); this.expandedDialog.setUndecorated(true); this.expandedDialog.setResizable(true); this.expandedDialog.addWindowFocusListener(this); Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { MouseEvent me = (MouseEvent) event; Component mouseComponent = me.getComponent(); if (mouseComponent == MessageConsole.this.getExpandedDialog()) { if (me.getID() == MouseEvent.MOUSE_EXITED) { MessageConsole.this .requestCloseExpandedDialog(); } } } }, AWTEvent.MOUSE_EVENT_MASK); this.expandedDialog.pack(); } return this.expandedDialog; }
/** * expanded dialog is used to keep the expanded panel on top of all other * windows * * @return the expanded dialog containing the expanded panel */ private JDialog getExpandedDialog() { if (this.expandedDialog == null) { this.expandedDialog = new JDialog( SwingUtilities.getWindowAncestor(this.getGui()), "expanded task visualizer"); this.expandedDialog.add(this.getExpandedPanel()); this.expandedDialog.setModalityType(ModalityType.MODELESS); this.expandedDialog.setUndecorated(true); } return this.expandedDialog; }