public void open() { progressArea.setText(""); canceled = false; Util.placeDialog(optDiag, panel.frame()); okButton.setEnabled(false); cancelButton.setEnabled(true); new FocusRequester(okButton); optDiag.setVisible(true); }
@Override public void storeSettings() { prefs.put(JabRefPreferences.PREVIEW_0, layout1.getText().replaceAll("\n", "__NEWLINE__")); prefs.put(JabRefPreferences.PREVIEW_1, layout2.getText().replaceAll("\n", "__NEWLINE__")); prefs.putBoolean(JabRefPreferences.PDF_PREVIEW, pdfPreview.isSelected()); }
public OptionsDialog(JFrame parent) { super(parent, Globals.lang("Writing XMP metadata for selected entries..."), false); okButton.setEnabled(false); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); AbstractAction cancel = new AbstractAction() { private static final long serialVersionUID = -338601477652815366L; public void actionPerformed(ActionEvent e) { canceled = true; } }; cancelButton.addActionListener(cancel); InputMap im = cancelButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap am = cancelButton.getActionMap(); im.put(Globals.prefs.getKey("Close dialog"), "close"); am.put("close", cancel); progressArea = new JTextArea(15, 60); JScrollPane scrollPane = new JScrollPane( progressArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); Dimension d = progressArea.getPreferredSize(); d.height += scrollPane.getHorizontalScrollBar().getHeight() + 15; d.width += scrollPane.getVerticalScrollBar().getWidth() + 15; panel.setSize(d); progressArea.setBackground(Color.WHITE); progressArea.setEditable(false); progressArea.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); progressArea.setText(""); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(3, 2, 3, 2)); panel.add(scrollPane); // progressArea.setPreferredSize(new Dimension(300, 300)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addGridded(okButton); bb.addRelatedGap(); bb.addGridded(cancelButton); bb.addGlue(); JPanel bbPanel = bb.getPanel(); bbPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3)); getContentPane().add(panel, BorderLayout.CENTER); getContentPane().add(bbPanel, BorderLayout.SOUTH); pack(); this.setResizable(false); }
@Override public void setValues() { layout1.setText(prefs.get(JabRefPreferences.PREVIEW_0).replaceAll("__NEWLINE__", "\n")); layout2.setText(prefs.get(JabRefPreferences.PREVIEW_1).replaceAll("__NEWLINE__", "\n")); pdfPreview.setSelected(prefs.getBoolean(JabRefPreferences.PDF_PREVIEW)); }