/** * Shows the dialog. Overrides shall call {@code super.show()} at the end. * * @return the identifier of the last button pressed or zero if this is a modeless dialog. */ public int show() { setButtonID(0); if (!shown) { dialog.pack(); center(); } dialog.setVisible(true); shown = true; return getButtonID(); }
protected AbstractDialog(JDialog dialog, int buttonMask, Object[] otherButtons, String helpID) { this.parent = (Window) dialog.getParent(); this.dialog = dialog; this.buttonMask = buttonMask; this.buttonMap = new HashMap<>(5); setComponentName(dialog); setButtonID(0); initUI(otherButtons); setHelpID(helpID); }
otherButton.setName(getQualifiedPropertyName(text)); otherButton.addActionListener(e -> { setButtonID(ID_OTHER); if (verifyUserInput()) { onOther(); AbstractButton otherButton = (AbstractButton) otherItem; otherButton.addActionListener(e -> { setButtonID(ID_OTHER); if (verifyUserInput()) { onOther(); button.setName(getQualifiedPropertyName("ok")); button.addActionListener(e -> { setButtonID(ID_OK); if (verifyUserInput()) { onOK(); button.setName(getQualifiedPropertyName("yes")); button.addActionListener(e -> { setButtonID(ID_YES); if (verifyUserInput()) { onYes(); button.setName(getQualifiedPropertyName("no")); button.addActionListener(e -> { setButtonID(ID_NO); if (verifyUserInput()) { onNo();