public void dispose(boolean toDispose) { if (toDispose) { super.dispose(); frame.toFront(); } if (client != null) client.dialogDismissed(this); }
protected synchronized void disposeGotoDialog() { if (gotoDialog != null) { EditorState.put(BOUNDS_KEY, gotoDialog.getBounds()); gotoDialog.dispose(); Utilities.returnFocus(); } gotoDialog = null; }
private void closeAll() { if (dialog != null) { dialog.dispose(); } if (parentDialog != null) { parentDialog.dispose(); } if (parentFrame != null) { parentFrame.dispose(); } }
// implementation of java.awt.event.ActionListener interface public void actionPerformed(JCActionEvent e) { if (e.getSource() == ok || e.getSource() == cancel) { if (e.getSource() == ok) { accept = true; } else { accept = false; } dialog.dispose(); } else { JCButton b = (JCButton) e.getSource(); Color c = b.getBackground(); updateColor(c, e.getSource()); } }
@Override public void actionPerformed(java.awt.event.ActionEvent e) { try { PropertyEditor propEd = property.getPropertyEditor(); propEd.setValue(property.getValue()); final Component custEditor = propEd.getCustomEditor(); Object[] options = buttons(); DialogDescriptor descriptor = new DialogDescriptor( custEditor, (String) getValue(Action.NAME), true, options, DialogDescriptor.CANCEL_OPTION, DialogDescriptor.DEFAULT_ALIGN, HelpCtx.DEFAULT_HELP, (ActionEvent e1) -> { try { String action = e1.getActionCommand(); switch (action) { case OK_COMMAND: Object value = property.getPropertyEditor().getValue(); property.setValue(value); break; case RESTORE_COMMAND: property.restoreDefaultValue(); break; } dialog.dispose(); } catch (Exception ex) { NotifyDescriptor descriptor2 = new NotifyDescriptor.Message( NbBundle.getMessage(PropertyAction.class, "MSG_InvalidValue")); // NOI18N DialogDisplayer.getDefault().notify(descriptor2); } }); descriptor.setClosingOptions(new Object[0]); dialog = DialogDisplayer.getDefault().createDialog(descriptor); dialog.setVisible(true); dialog = null; } catch (Exception ex) { ErrorManager.getDefault().notify(ex); } }
/** Handles button events */ public void actionPerformed(ActionEvent e) { // only chooseMainClassButton can be performed final MainClassChooser panel = new MainClassChooser(sourceRoots.getRoots(), null, mainClassTextField.getText()); Object[] options = new Object[] {okButton, DialogDescriptor.CANCEL_OPTION}; panel.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof MouseEvent && MouseUtils.isDoubleClick(((MouseEvent) e.getSource()))) { // click button and finish the dialog with selected class okButton.doClick(); } else { okButton.setEnabled(panel.getSelectedMainClass() != null); } } }); okButton.setEnabled(false); DialogDescriptor desc = new DialogDescriptor( panel, NbBundle.getMessage(CustomizerRun.class, "LBL_ChooseMainClass_Title"), // NOI18N 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]) { mainClassTextField.setText(panel.getSelectedMainClass()); } dlg.dispose(); }
public static int crossOver(int version, JoConnection conn, Config config) throws Exception { Dialog dlg = null; try { if (version < 1002) { // ---------------------------------------------------- // New Columns GamePlayer.Color and GamePlayer.Result // ---------------------------------------------------- dlg = JoDialog.createMessageDialog( "Database Update", "jose will now update the database structure.\n" + "This may take up to some minutes.", false); dlg.show(); dlg.paint(dlg.getGraphics()); Setup setup = new Setup(config, "MAIN", conn); /* setup.addColumn("GamePlayer","Color",3); setup.addColumn("GamePlayer","Result",4); /* alter table gameplayer modify column PId integer not null, add column Color tinyint not null, add index GamePlayer_3 (Color), add column Result tinyint not null, add index GamePlayer_4 (Result) * / // fill in values String upd1 = "UPDATE GamePlayer, Game" + " SET GamePlayer.Color = 1, GamePlayer.Result = Game.Result" + " WHERE GamePlayer.GId = Game.Id" + " AND GamePlayer.PId = Game.WhiteId"; /** Color = 1 = White * Result = Game.Result (from white's perspective) * / conn.executeUpdate(upd1); String upd2 = "UPDATE GamePlayer, Game" + " SET GamePlayer.Result = CASE WHEN Game.Result < 0 THEN Game.Result ELSE 2-Game.Result END" + " WHERE GamePlayer.GId = Game.Id" + " AND GamePlayer.PId = Game.BlackId"; /** Color = 0 = Black * Result = 2-Game.Result (from black's perspective) * / conn.executeUpdate(upd2); */ System.err.print("[create GamePlayer"); try { setup.dropTable("GamePlayer"); } catch (Exception e) { Application.error(e); } setup.createTable(null, setup.getTable("GamePlayer"), null, true); JoConnection.getAdapter().disableConstraints("GamePlayer", conn); String ins = "INSERT INTO GamePlayer" + " SELECT Id, WhiteId, 1, Result FROM Game " + " UNION" + " SELECT Id, BlackId, 0, CASE WHEN Result<0 THEN Result ELSE 2-Result END FROM Game"; conn.executeUpdate(ins); JoConnection.getAdapter().enableConstraints("GamePlayer", conn); System.err.println("]"); Setup.setTableVersion(conn, "MAIN", "GamePlayer", 102); Setup.setSchemaVersion(conn, "MAIN", version = 1002); } return version; } finally { if (dlg != null) dlg.dispose(); } }