Ticket #1645: ResizePreferencesDialog_patch.txt

File ResizePreferencesDialog_patch.txt, 2.0 KB (added by jpstotz, 17 years ago)

Patch for making the preferences dialog resize correctly. Makes the dialog usable even on extremely small display resolutions.

Line 
1Index: src/org/openstreetmap/josm/actions/PreferencesAction.java
2===================================================================
3--- src/org/openstreetmap/josm/actions/PreferencesAction.java (revision 1031)
4+++ src/org/openstreetmap/josm/actions/PreferencesAction.java (working copy)
5@@ -3,6 +3,7 @@
6
7 import static org.openstreetmap.josm.tools.I18n.tr;
8
9+import java.awt.Dimension;
10 import java.awt.GridBagLayout;
11 import java.awt.event.ActionEvent;
12 import java.awt.event.KeyEvent;
13@@ -36,12 +37,14 @@
14 */
15 public void actionPerformed(ActionEvent e) {
16 PreferenceDialog prefDlg = new PreferenceDialog();
17+ prefDlg.setMinimumSize(new Dimension(300,200));
18 JPanel prefPanel = new JPanel(new GridBagLayout());
19 prefPanel.add(prefDlg, GBC.eol().fill(GBC.BOTH));
20
21 JOptionPane pane = new JOptionPane(prefPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
22 JDialog dlg = pane.createDialog(Main.parent, tr("Preferences"));
23 dlg.setResizable(true);
24+ dlg.setMinimumSize(new Dimension(400,300));
25
26 // if (dlg.getWidth() > 600)
27 // dlg.setSize(600, dlg.getHeight());
28Index: src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
29===================================================================
30--- src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java (revision 1027)
31+++ src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java (working copy)
32@@ -15,6 +15,7 @@
33 import javax.swing.JLabel;
34 import javax.swing.JOptionPane;
35 import javax.swing.JPanel;
36+import javax.swing.JScrollPane;
37 import javax.swing.JTabbedPane;
38
39 import org.openstreetmap.josm.Main;
40@@ -59,7 +60,8 @@
41 descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC));
42 p.add(descLabel, GBC.eol().insets(5,0,5,20).fill(GBC.HORIZONTAL));
43
44- addTab(null, ImageProvider.get("preferences", icon), p);
45+ JScrollPane sp = new JScrollPane(p);
46+ addTab(null, ImageProvider.get("preferences", icon), sp);
47 setToolTipTextAt(getTabCount()-1, "<html>"+desc+"</html>");
48 return p;
49 }