/** Initializes this dialog. */ private void initDialog() { setMinimumSize(new Dimension(640, 480)); final JComponent settingsPane = createSettingsPane(); final JComponent previewPane = createPreviewPane(); final JPanel contentPane = new JPanel(new GridBagLayout()); contentPane.add( settingsPane, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(2, 0, 2, 0), 0, 0)); contentPane.add( previewPane, new GridBagConstraints( 1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(2, 0, 2, 0), 0, 0)); final JButton runAnalysisButton = ToolUtils.createRunAnalysisButton(this); this.runAnalysisAction = (RestorableAction) runAnalysisButton.getAction(); final JButton exportButton = ToolUtils.createExportButton(this); this.exportAction = exportButton.getAction(); this.exportAction.setEnabled(false); final JButton closeButton = ToolUtils.createCloseButton(); this.closeAction = closeButton.getAction(); final JComponent buttons = SwingComponentUtils.createButtonPane(runAnalysisButton, exportButton, closeButton); SwingComponentUtils.setupWindowContentPane(this, contentPane, buttons, runAnalysisButton); }
/** * @param owner the parent Window (Dialog or Frame) * @param frame the JabRef Frame * @param panel the currently selected BasePanel * @param modal should this dialog be modal? * @param metaData The metadata of the current database * @param fieldName the field this selector is initialized for. May be null. */ public ContentSelectorDialog2( Window owner, JabRefFrame frame, BasePanel panel, boolean modal, MetaData metaData, String fieldName) { super(owner, Globals.lang("Setup selectors")); this.setModal(modal); this.metaData = metaData; this.frame = frame; this.panel = panel; this.currentField = fieldName; // help = new JButton(Globals.lang("Help")); // help.addActionListener(new HelpAction(frame.helpDiag, GUIGlobals.contentSelectorHelp, // "Help")); // help = new HelpAction(frame.helpDiag, GUIGlobals.contentSelectorHelp, "Help"); initLayout(); // wordSelector.addItem(WORD_EMPTY_TEXT); setupFieldSelector(); setupWordSelector(); setupActions(); Util.bindCloseDialogKeyToCancelAction(this.rootPane, cancel.getAction()); int fieldInd = fieldListModel.indexOf(currentField); if (fieldInd >= 0) fieldList.setSelectedIndex(fieldInd); pack(); }
@Override public ButtonPanel createButtonPanel() { ButtonPanel buttonPanel = new ButtonPanel(); JButton okButton = new JButton(); JButton cancelButton = new JButton(); JButton helpButton = new JButton(); okButton.setName(OK); cancelButton.setName(CANCEL); helpButton.setName(HELP); buttonPanel.addButton(okButton, ButtonPanel.AFFIRMATIVE_BUTTON); buttonPanel.addButton(cancelButton, ButtonPanel.CANCEL_BUTTON); buttonPanel.addButton(helpButton, ButtonPanel.HELP_BUTTON); okButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.okButtonText")) { public void actionPerformed(ActionEvent e) { setDialogResult(RESULT_AFFIRMED); setVisible(false); dispose(); } }); cancelButton.setAction( new AbstractAction(UIDefaultsLookup.getString("OptionPane.cancelButtonText")) { public void actionPerformed(ActionEvent e) { setDialogResult(RESULT_CANCELLED); setVisible(false); dispose(); } }); final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(Locale.getDefault()); helpButton.setAction( new AbstractAction(resourceBundle.getString("Button.help")) { public void actionPerformed(ActionEvent e) { // do something } }); helpButton.setMnemonic(resourceBundle.getString("Button.help.mnemonic").charAt(0)); setDefaultCancelAction(cancelButton.getAction()); setDefaultAction(okButton.getAction()); getRootPane().setDefaultButton(okButton); buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return buttonPanel; }