Browse Source

Issue 578: Buttons move in the channel settings screen


git-svn-id: http://svn.dmdirc.com/branches/0.5.5@3049 00569f92-eb28-0410-84fd-f71c24880f
remotes/0.5.5
Gregory Holmes 16 years ago
parent
commit
e4e1ddbe6e

+ 17
- 9
src/com/dmdirc/ui/swing/components/expandingsettings/SettingsPanel.java View File

@@ -23,7 +23,8 @@
23 23
 package com.dmdirc.ui.swing.components.expandingsettings;
24 24
 
25 25
 import com.dmdirc.config.Identity;
26
-import com.dmdirc.ui.swing.components.TextLabel;
26
+import com.dmdirc.ui.swing.JWrappingLabel;
27
+import java.awt.Dimension;
27 28
 import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
28 29
 
29 30
 import java.awt.GridBagConstraints;
@@ -69,7 +70,7 @@ public final class SettingsPanel extends JPanel {
69 70
     private Map<String, OptionType> types;
70 71
     
71 72
     /** Info label. */
72
-    private TextLabel infoLabel;
73
+    private JWrappingLabel infoLabel;
73 74
     
74 75
     /** Current options panel. */
75 76
     private CurrentOptionsPanel currentOptionsPanel;
@@ -83,14 +84,16 @@ public final class SettingsPanel extends JPanel {
83 84
      *
84 85
      * @param config Config to use
85 86
      * @param infoText Info blurb.
87
+     * @param size Maximum width of the layout
86 88
      */
87
-    public SettingsPanel(final Identity config, final String infoText) {
89
+    public SettingsPanel(final Identity config, final String infoText, 
90
+            final int size) {
88 91
         super();
89 92
         
90 93
         this.config = config;
91 94
         
92 95
         initComponents(infoText);
93
-        layoutComponents();
96
+        layoutComponents(size);
94 97
     }
95 98
     
96 99
     /**
@@ -102,7 +105,7 @@ public final class SettingsPanel extends JPanel {
102 105
         names = new LinkedHashMap<String, String>();
103 106
         types = new LinkedHashMap<String, OptionType>();
104 107
         
105
-        infoLabel = new TextLabel(infoText);
108
+        infoLabel = new JWrappingLabel(infoText);
106 109
         
107 110
         addOptionPanel =
108 111
                 new AddOptionPanel(this);
@@ -121,8 +124,12 @@ public final class SettingsPanel extends JPanel {
121 124
                 SMALL_BORDER, SMALL_BORDER)));
122 125
     }
123 126
     
124
-    /** Lays out the components. */
125
-    private void layoutComponents() {
127
+    /** 
128
+     * Lays out the components.
129
+     * 
130
+     * @param size Maximum width of the layout
131
+     */
132
+    private void layoutComponents(final int size) {
126 133
         final GridBagConstraints constraints = new GridBagConstraints();
127 134
         
128 135
         setLayout(new GridBagLayout());
@@ -132,6 +139,7 @@ public final class SettingsPanel extends JPanel {
132 139
         constraints.weightx = 1.0;
133 140
         constraints.weighty = 0.0;
134 141
         constraints.fill = GridBagConstraints.HORIZONTAL;
142
+        infoLabel.setMaximumSize(new Dimension(size, 0));
135 143
         add(infoLabel, constraints);
136 144
         
137 145
         constraints.gridy = 1;
@@ -246,7 +254,7 @@ public final class SettingsPanel extends JPanel {
246 254
      *
247 255
      * @return Display name for a specified option
248 256
      */
249
-    protected String getOptionName(final String optionName) {
257
+    public String getOptionName(final String optionName) {
250 258
         return names.get(optionName);
251 259
     }
252 260
     
@@ -257,7 +265,7 @@ public final class SettingsPanel extends JPanel {
257 265
      *
258 266
      * @return Option type for a specified option
259 267
      */
260
-    protected OptionType getOptionType(final String optionName) {
268
+    public OptionType getOptionType(final String optionName) {
261 269
         return types.get(optionName);
262 270
     }
263 271
 }

+ 1
- 1
src/com/dmdirc/ui/swing/dialogs/channelsetting/ChannelSettingsDialog.java View File

@@ -176,7 +176,7 @@ public final class ChannelSettingsDialog extends StandardDialog implements Actio
176 176
         channelSettingsPane =
177 177
                 new SettingsPanel(identity,
178 178
                 "These settings are specific to this channel on this network, " +
179
-                "any settings specified here will overwrite global settings");
179
+                "any settings specified here will overwrite global settings", 500);
180 180
 
181 181
         channelSettingsPane.addOption("channel.splitusermodes",
182 182
                 "Split user modes",

+ 2
- 1
src/com/dmdirc/ui/swing/dialogs/serversetting/ServerSettingsDialog.java View File

@@ -139,8 +139,9 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
139 139
 
140 140
         settingsPanel =
141 141
                 new SettingsPanel(server.getNetworkIdentity(),
142
+                "These settings are specific to this " +
142 143
                 "network, any settings specified here will overwrite global " +
143
-                "settings");
144
+                "settings", 500);
144 145
 
145 146
         if (settingsPanel != null) {
146 147
             addSettings();

Loading…
Cancel
Save