Changeset 1053 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2008-10-23T17:27:57+02:00 (15 years ago)
Author:
stoecker
Message:

added preferences patch to get correct window sizes again. Fixes #1671 and #1672. Patch by Jan Peter Stotz

Location:
trunk/src/org/openstreetmap/josm
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PreferencesAction.java

    r1042 r1053  
    3838        public void actionPerformed(ActionEvent e) {
    3939                PreferenceDialog prefDlg = new PreferenceDialog();
    40                 prefDlg.setMinimumSize(new Dimension(300,200));
     40                prefDlg.setMinimumSize(new Dimension(400,300));
    4141                JPanel prefPanel = new JPanel(new GridBagLayout());
    4242                prefPanel.add(prefDlg, GBC.eol().fill(GBC.BOTH));
     
    4545                JDialog dlg = pane.createDialog(Main.parent, tr("Preferences"));
    4646                dlg.setResizable(true);
    47                 dlg.setMinimumSize(new Dimension(400,300));
     47                dlg.setMinimumSize(new Dimension(500,400));
    4848
    4949//              if (dlg.getWidth() > 600)
  • trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java

    r1032 r1053  
    3636
    3737        public void addGui(final PreferenceDialog gui) {
    38                 JPanel p = gui.createPreferenceTab("advanced", tr("Advanced Preferences"), tr("Setting Preference entries directly. Use with caution!"));
     38                JPanel p = gui.createPreferenceTab("advanced", tr("Advanced Preferences"),
     39                        tr("Setting Preference entries directly. Use with caution!"), false);
    3940
    4041                model = new DefaultTableModel(new String[]{tr("Key"), tr("Value")},0) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java

    r804 r1053  
    22package org.openstreetmap.josm.gui.preferences;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.marktr;
    66
    77import java.awt.Color;
     
    104104                        }
    105105                };
     106                colors.setPreferredSize(new Dimension(200,200));
    106107                colors.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    107108                final TableCellRenderer oldColorsRenderer = colors.getDefaultRenderer(Object.class);
  • trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java

    r1048 r1053  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
     6import java.awt.Dimension;
    67import java.awt.event.ActionEvent;
    78import java.awt.event.ActionListener;
     
    3334
    3435        public void addGui(PreferenceDialog gui) {
    35                 // drawRawGpsLines
     36            gui.display.setPreferredSize(new Dimension(400,600));
     37            // drawRawGpsLines
    3638                drawRawGpsLines.addActionListener(new ActionListener(){
    3739                        public void actionPerformed(ActionEvent e) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java

    r1047 r1053  
    2929                // let's try to load additional LookAndFeels and put them into the list
    3030                try {
    31                         Class Cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel");
     31                        Class<?> Cquaqua = Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel");
    3232                        Object Oquaqua = Cquaqua.getConstructor((Class[])null).newInstance((Object[])null);
    3333                        // no exception? Then Go!
  • trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

    r1028 r1053  
    7474                        if(n instanceof PluginDescription)
    7575                                return name.compareToIgnoreCase(((PluginDescription)n).name);
    76                         else
    77                                 return -1;
     76                        return -1;
    7877                }
    7978        }
     
    107106        public void addGui(final PreferenceDialog gui) {
    108107                this.gui = gui;
    109                 plugin = gui.createPreferenceTab("plugin", tr("Plugins"), tr("Configure available plugins."));
     108                plugin = gui.createPreferenceTab("plugin", tr("Plugins"), tr("Configure available plugins."), false);
    110109                JScrollPane pluginPane = new JScrollPane(pluginPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    111110                pluginPane.setBorder(null);
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r1042 r1053  
    66import java.awt.Font;
    77import java.awt.GridBagLayout;
     8import java.awt.ScrollPane;
    89import java.awt.event.ActionEvent;
    910import java.awt.event.ActionListener;
     
    1314
    1415import javax.swing.BorderFactory;
     16import javax.swing.JComponent;
    1517import javax.swing.JLabel;
    1618import javax.swing.JOptionPane;
     
    4547        /**
    4648         * Construct a JPanel for the preference settings. Layout is GridBagLayout
    47          * and a centered title label and the description are added.
     49         * and a centered title label and the description are added. The panel
     50         * will be shown inside a {@link ScrollPane}
    4851         * @param icon The name of the icon.
    4952         * @param title The title of this preference tab.
     
    5356         */
    5457        public JPanel createPreferenceTab(String icon, String title, String desc) {
    55                 JPanel p = new JPanel(new GridBagLayout());
    56                 p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    57                 p.add(new JLabel(title), GBC.eol().anchor(GBC.CENTER).insets(0,5,0,10));
    58 
    59                 JLabel descLabel = new JLabel("<html>"+desc+"</html>");
    60                 descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC));
    61                 p.add(descLabel, GBC.eol().insets(5,0,5,20).fill(GBC.HORIZONTAL));
    62 
    63         JScrollPane sp = new JScrollPane(p);
    64                 addTab(null, ImageProvider.get("preferences", icon), sp);
    65                 setToolTipTextAt(getTabCount()-1, "<html>"+desc+"</html>");
    66                 return p;
     58                return createPreferenceTab(icon, title, desc, true);
    6759        }
    6860
     61    /**
     62     * Construct a JPanel for the preference settings. Layout is GridBagLayout
     63     * and a centered title label and the description are added.
     64     * @param icon The name of the icon.
     65     * @param title The title of this preference tab.
     66     * @param desc A description in one sentence for this tab. Will be displayed
     67     *      italic under the title.
     68     * @param inScrollPane if <code>true</code> the added tab will show scroll bars
     69     *        if the panel content is larger than the available space
     70     * @return The created panel ready to add other controls.
     71     */
     72    public JPanel createPreferenceTab(String icon, String title, String desc, boolean inScrollPane) {
     73        JPanel p = new JPanel(new GridBagLayout());
     74        p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     75        p.add(new JLabel(title), GBC.eol().anchor(GBC.CENTER).insets(0,5,0,10));
     76
     77        JLabel descLabel = new JLabel("<html>"+desc+"</html>");
     78        descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC));
     79        p.add(descLabel, GBC.eol().insets(5,0,5,20).fill(GBC.HORIZONTAL));
     80
     81        JComponent tab = p;
     82        if (inScrollPane) {
     83            JScrollPane sp = new JScrollPane(p);
     84            tab = sp;
     85        }
     86        addTab(null, ImageProvider.get("preferences", icon), tab);
     87        setToolTipTextAt(getTabCount()-1, "<html>"+desc+"</html>");
     88        return p;
     89    }
    6990
    7091
  • trunk/src/org/openstreetmap/josm/gui/preferences/ProxyPreferences.java

    r995 r1053  
    2828
    2929        private JCheckBox proxyEnable = new JCheckBox(tr("Enable proxy server"));
    30         private JTextField proxyHost = new JTextField(50);
     30        private JTextField proxyHost = new JTextField(20);
    3131        private JTextField proxyPort = new JTextField(5);
    3232        private JCheckBox proxyAnonymous = new JCheckBox(tr("Anonymous"));
    33         private JTextField proxyUser = new JTextField(50);
    34         private JPasswordField proxyPass = new JPasswordField(50);
     33        private JTextField proxyUser = new JTextField(20);
     34        private JPasswordField proxyPass = new JPasswordField(20);
    3535
    3636        public void addGui(PreferenceDialog gui) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/ShortcutPreference.java

    r1046 r1053  
    2222                // icon original size: 128x128
    2323                // modifications: icon was cropped, then resized
    24                 JPanel p = gui.createPreferenceTab("shortcuts", tr("Shortcut Preferences"), tr("Changing keyboard shortcuts manually."));
     24                JPanel p = gui.createPreferenceTab("shortcuts", tr("Shortcut Preferences"),
     25                        tr("Changing keyboard shortcuts manually."), false);
    2526
    2627                prefJPanel prefpanel = new prefJPanel(new scListModel());
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r999 r1053  
    197197                p.add(right);
    198198
    199                 JPanel panel = gui.createPreferenceTab("toolbar", tr("Toolbar customization"), tr("Customize the elements on the toolbar."));
     199                JPanel panel = gui.createPreferenceTab("toolbar", tr("Toolbar customization"),
     200                        tr("Customize the elements on the toolbar."), false);
    200201                panel.add(p, GBC.eol().fill(GBC.BOTH));
    201202
  • trunk/src/org/openstreetmap/josm/gui/preferences/prefJPanel.java

    r1047 r1053  
    88
    99import static org.openstreetmap.josm.tools.I18n.tr;
    10 import javax.swing.table.TableModel;
     10
    1111import java.awt.event.KeyEvent;
     12import java.util.LinkedHashMap;
    1213import java.util.Map;
    13 import java.util.LinkedHashMap;
    14 import javax.swing.event.ListSelectionListener;
    15 import javax.swing.event.ListSelectionEvent;
    16 import javax.swing.ListSelectionModel;
    17 import org.openstreetmap.josm.tools.ShortCut;
     14
    1815import javax.swing.JEditorPane;
    1916import javax.swing.JScrollPane;
     17import javax.swing.ListSelectionModel;
     18import javax.swing.event.ListSelectionEvent;
     19import javax.swing.event.ListSelectionListener;
     20import javax.swing.table.TableModel;
     21
    2022import org.openstreetmap.josm.Main;
     23import org.openstreetmap.josm.tools.ShortCut;
    2124
    2225/**
     
    247250        // Would be a nice array if I had done it by hand. But then, it would be finished next year or so...
    248251        modifierTab.setLayout(new java.awt.GridLayout(0, 1));
     252        JScrollPane modifierScroller = new JScrollPane(modifierTab);
    249253
    250254        editGroupPane.setBorder(javax.swing.BorderFactory.createTitledBorder(tr("Edit Shortcuts")));
     
    352356                                bxTer4.setAction(action2);
    353357
    354         modifierTab.add(subwindowGroupPane);
    355 
    356         prefTabPane.addTab(tr("Modifier Groups"), modifierTab);
     358                modifierTab.add(subwindowGroupPane);
     359
     360        prefTabPane.addTab(tr("Modifier Groups"), modifierScroller);
    357361
    358362        add(prefTabPane);
Note: See TracChangeset for help on using the changeset viewer.