Sfoglia il codice sorgente

issue 1274: Code tidying (all layouts are now done using miglayout)

git-svn-id: http://svn.dmdirc.com/trunk@4199 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 anni fa
parent
commit
f29b39e083

+ 4
- 9
src/com/dmdirc/addons/osdplugin/OsdWindow.java Vedi File

@@ -26,11 +26,8 @@ import com.dmdirc.Main;
26 26
 import com.dmdirc.config.IdentityManager;
27 27
 import com.dmdirc.ui.messages.ColourManager;
28 28
 import com.dmdirc.ui.swing.MainFrame;
29
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
30 29
 
31
-import java.awt.BorderLayout;
32 30
 import java.awt.Color;
33
-import java.awt.Dimension;
34 31
 import java.awt.Point;
35 32
 import java.awt.event.MouseEvent;
36 33
 import java.awt.event.MouseListener;
@@ -47,6 +44,8 @@ import javax.swing.SwingConstants;
47 44
 import javax.swing.WindowConstants;
48 45
 import javax.swing.border.LineBorder;
49 46
 
47
+import net.miginfocom.swing.MigLayout;
48
+
50 49
 /**
51 50
  * The OSD Window is an always-on-top window designed to convey information
52 51
  * about events to the user.
@@ -153,9 +152,6 @@ public final class OsdWindow extends JDialog implements MouseListener,
153 152
         
154 153
         setFocusableWindowState(false);
155 154
         setAlwaysOnTop(true);
156
-        setSize(new Dimension(500, 
157
-                IdentityManager.getGlobalConfig().getOptionInt("plugin-OSD", "fontSize", 20)
158
-                + LARGE_BORDER));
159 155
         setResizable(false);
160 156
         setUndecorated(true);
161 157
         
@@ -169,7 +165,7 @@ public final class OsdWindow extends JDialog implements MouseListener,
169 165
                 "bgcolour", Color.decode("#2222aa")));
170 166
         
171 167
         setContentPane(panel);
172
-        setLayout(new BorderLayout());
168
+        setLayout(new MigLayout("pack, wmin 500, ins rel"));
173 169
         
174 170
         label = new JLabel(text);
175 171
         label.setForeground(IdentityManager.getGlobalConfig().getOptionColour("plugin-OSD",
@@ -178,7 +174,7 @@ public final class OsdWindow extends JDialog implements MouseListener,
178 174
                 (float) IdentityManager.getGlobalConfig().getOptionInt("plugin-OSD",
179 175
                 "fontSize", 20)));
180 176
         label.setHorizontalAlignment(SwingConstants.CENTER);
181
-        add(label);
177
+        add(label, "grow");
182 178
         
183 179
         setVisible(true);
184 180
         
@@ -246,7 +242,6 @@ public final class OsdWindow extends JDialog implements MouseListener,
246 242
      */
247 243
     public void setFontSize(final int size) {
248 244
         label.setFont(label.getFont().deriveFont((float) size));
249
-        setSize(new Dimension(500, size + LARGE_BORDER));
250 245
     }
251 246
 
252 247
     /**

+ 1
- 0
src/com/dmdirc/installer/Main.java Vedi File

@@ -70,6 +70,7 @@ public final class Main implements WizardListener {
70 70
 		setWizardFrame(new WizardFrame(releaseName + " Installer", new ArrayList<Step>(), this));
71 71
 		wizardDialog.setIconImage(IconManager.getIconManager().getImage("icon"));
72 72
 		wizardDialog.setPreferredSize(new Dimension(400, 350));
73
+		wizardDialog.setMaximumSize(new Dimension(400, 350));
73 74
 		wizardDialog.addWizardListener(this);
74 75
 
75 76
 		final String osName = System.getProperty("os.name");

+ 3
- 9
src/com/dmdirc/installer/StepConfirm.java Vedi File

@@ -27,12 +27,8 @@ import com.dmdirc.ui.swing.components.TextLabel;
27 27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28 28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
29 29
 import com.dmdirc.ui.swing.dialogs.wizard.WizardFrame;
30
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
31
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
32 30
 
33
-import java.awt.BorderLayout;
34
-
35
-import javax.swing.BorderFactory;
31
+import net.miginfocom.swing.MigLayout;
36 32
 
37 33
 /**
38 34
  * This confirms the settings chosen in the previous step
@@ -55,13 +51,11 @@ public final class StepConfirm extends Step implements StepListener {
55 51
 	public StepConfirm(final WizardFrame dialog) {
56 52
 		super();
57 53
 		dialog.addStepListener(this);
58
-		setLayout(new BorderLayout());
59
-		setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
54
+		setLayout(new MigLayout());
60 55
 
61 56
 		infoLabel.setOpaque(false);
62
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
63 57
 
64
-		add(infoLabel, BorderLayout.CENTER);
58
+		add(infoLabel, "grow");
65 59
 	}
66 60
 
67 61
 	/** {@inheritDoc} */

+ 3
- 9
src/com/dmdirc/installer/StepError.java Vedi File

@@ -24,12 +24,8 @@ package com.dmdirc.installer;
24 24
 
25 25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
26 26
 import com.dmdirc.ui.swing.components.TextLabel;
27
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
28
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
29 27
 
30
-import java.awt.BorderLayout;
31
-
32
-import javax.swing.BorderFactory;
28
+import net.miginfocom.swing.MigLayout;
33 29
 
34 30
 /**
35 31
  * This step shows an unable to install error
@@ -56,14 +52,12 @@ public final class StepError extends Step {
56 52
 	 */
57 53
 	public StepError(final String message) {
58 54
 		super();
59
-		setLayout(new BorderLayout());
60
-		setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
55
+		setLayout(new MigLayout());
61 56
 		
62 57
 		TextLabel infoLabel;
63 58
 		infoLabel = new TextLabel(message);
64 59
 		infoLabel.setOpaque(false);
65
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
66 60
 			
67
-		add(infoLabel, BorderLayout.CENTER);
61
+		add(infoLabel, "grow");
68 62
 	}
69 63
 }

+ 5
- 9
src/com/dmdirc/installer/StepInstall.java Vedi File

@@ -27,16 +27,14 @@ import com.dmdirc.installer.Installer.ShortcutType;
27 27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28 28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
29 29
 import com.dmdirc.ui.swing.dialogs.wizard.WizardFrame;
30
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
31
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
32 30
 
33
-import java.awt.BorderLayout;
34 31
 import javax.swing.UIManager;
35 32
 
36
-import javax.swing.BorderFactory;
37 33
 import javax.swing.JTextArea;
38 34
 import javax.swing.JScrollPane;
39 35
 
36
+import net.miginfocom.swing.MigLayout;
37
+
40 38
 /**
41 39
  * This confirms the settings chosen in the previous step
42 40
  */
@@ -61,21 +59,19 @@ public final class StepInstall extends Step implements StepListener {
61 59
 	public StepInstall(final WizardFrame dialog) {
62 60
 		super();
63 61
 		dialog.addStepListener(this);
64
-		setLayout(new BorderLayout());
65
-		setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
62
+		setLayout(new MigLayout("fill"));
66 63
 
67 64
 		infoLabel.setFont(UIManager.getFont("Label.font"));
68 65
 		infoLabel.setEditable(false);
69 66
 		infoLabel.setWrapStyleWord(true);
70 67
 		infoLabel.setLineWrap(true);
71
-		infoLabel.setHighlighter(null);
68
+		//infoLabel.setHighlighter(null);
72 69
 		infoLabel.setOpaque(false);
73 70
 		infoLabel.setFont(UIManager.getFont("TextField.font"));
74 71
 //		infoLabel.setBackground(getBackground());
75
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
76 72
 
77 73
 		scrollPane = new JScrollPane(infoLabel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
78
-		add(scrollPane, BorderLayout.CENTER);
74
+		add(scrollPane, "grow");
79 75
 	}
80 76
 
81 77
 	/**

+ 10
- 45
src/com/dmdirc/installer/StepSettings.java Vedi File

@@ -26,19 +26,13 @@ import com.dmdirc.installer.cliparser.CLIParser;
26 26
 import com.dmdirc.installer.Installer.ShortcutType;
27 27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28 28
 import com.dmdirc.ui.swing.components.TextLabel;
29
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
30
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
31 29
 
32
-import java.awt.GridBagConstraints;
33
-import java.awt.GridBagLayout;
34
-import java.awt.Insets;
35
-
36
-import javax.swing.BorderFactory;
37
-import javax.swing.Box;
38 30
 import javax.swing.JCheckBox;
39 31
 import javax.swing.JLabel;
40 32
 import javax.swing.JTextField;
41 33
 
34
+import net.miginfocom.swing.MigLayout;
35
+
42 36
 /**
43 37
  * Queries the user for where to install dmdirc, and if they want to setup shortcuts
44 38
  */
@@ -66,9 +60,7 @@ public final class StepSettings extends Step {
66 60
 	 */
67 61
 	public StepSettings() {
68 62
 		super();
69
-		final GridBagConstraints constraints = new GridBagConstraints();
70
-		setLayout(new GridBagLayout());
71
-		setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
63
+		setLayout(new MigLayout("wrap 1"));
72 64
 
73 65
 		TextLabel infoLabel;
74 66
 		infoLabel = new TextLabel("Here you can choose options for the install.\n");
@@ -78,58 +70,31 @@ public final class StepSettings extends Step {
78 70
 //		infoLabel.setHighlighter(null);
79 71
 		infoLabel.setOpaque(false);
80 72
 //		infoLabel.setBackground(getBackground());
81
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
82 73
 
83 74
 		shortcutMenu.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-menu") == 0));
84 75
 		shortcutDesktop.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-desktop") == 0));
85 76
 		shortcutQuick.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-quicklaunch") == 0));
86 77
 		shortcutProtocol.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-protocol") == 0));
87 78
 
88
-		constraints.weightx = 1.0;
89
-		constraints.fill = constraints.BOTH;
90
-		constraints.gridx = 0;
91
-		constraints.gridy = 0;
92
-		constraints.gridwidth = 2;
93
-		add(infoLabel, constraints);
94
-
95
-		constraints.weightx = 0.0;
96
-		constraints.gridwidth = 1;
97
-		constraints.gridy = 1;
98
-		constraints.fill = constraints.NONE;
99
-		constraints.insets = new Insets(LARGE_BORDER, 0, 0, 0);
100
-		add(new JLabel("Install Location: "), constraints);
101
-		constraints.fill = constraints.HORIZONTAL;
102
-		constraints.gridx = 1;
103
-		add(location, constraints);
104
-
105
-		constraints.gridwidth = 2;
106
-		constraints.gridx = 0;
107
-		constraints.insets = new Insets(SMALL_BORDER, 0, 0, 0);
79
+		add(infoLabel);
80
+		add(new JLabel("Install Location: "));
81
+		add(location, "growx, pushx");
108 82
 
109 83
 		if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
110
-			constraints.gridy = (constraints.gridy + 1);
111
-			add(shortcutMenu, constraints);
84
+			add(shortcutMenu, "");
112 85
 		}
113 86
 
114 87
 		if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)) {
115
-			constraints.gridy = (constraints.gridy + 1);
116
-			add(shortcutDesktop, constraints);
88
+			add(shortcutDesktop, "");
117 89
 		}
118 90
 
119 91
 		if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)) {
120
-			constraints.gridy = (constraints.gridy + 1);
121
-			add(shortcutQuick, constraints);
92
+			add(shortcutQuick, "");
122 93
 		}
123 94
 
124 95
 		if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)) {
125
-			constraints.gridy = (constraints.gridy + 1);
126
-			add(shortcutProtocol, constraints);
96
+			add(shortcutProtocol, "");
127 97
 		}
128
-
129
-		constraints.gridy = (constraints.gridy + 1);
130
-		constraints.weighty = 1.0;
131
-		constraints.fill = constraints.BOTH;
132
-		add(Box.createVerticalGlue(), constraints);
133 98
 	}
134 99
 
135 100
 	/**

+ 3
- 14
src/com/dmdirc/installer/StepWelcome.java Vedi File

@@ -24,12 +24,8 @@ package com.dmdirc.installer;
24 24
 
25 25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
26 26
 import com.dmdirc.ui.swing.components.TextLabel;
27
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
28
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
29 27
 
30
-import java.awt.BorderLayout;
31
-
32
-import javax.swing.BorderFactory;
28
+import net.miginfocom.swing.MigLayout;
33 29
 
34 30
 /**
35 31
  * Tells the user what this application does
@@ -47,8 +43,7 @@ public final class StepWelcome extends Step {
47 43
 	 */
48 44
 	public StepWelcome(final String releaseName) {
49 45
 		super();
50
-		setLayout(new BorderLayout());
51
-		setBorder(BorderFactory.createEmptyBorder(LARGE_BORDER, LARGE_BORDER, SMALL_BORDER, LARGE_BORDER));
46
+		setLayout(new MigLayout());
52 47
 		
53 48
 		TextLabel infoLabel;
54 49
 		infoLabel = new TextLabel("Welcome to the "+releaseName+" installer. This program will install DMDirc on this computer.\n\n"
@@ -56,14 +51,8 @@ public final class StepWelcome extends Step {
56 51
 		                        + "Gregory Holmes. DMDirc is released for free under the MIT license; for more information, "
57 52
 		                        + "please visit www.DMDirc.com.\n\n"
58 53
 		                        + "Click \"Next\" to continue, or close this program to cancel the installation.");
59
-//		infoLabel.setEditable(false);
60
-//		infoLabel.setWrapStyleWord(true);
61
-//		infoLabel.setLineWrap(true);
62
-//		infoLabel.setHighlighter(null);
63 54
 		infoLabel.setOpaque(false);
64
-//		infoLabel.setBackground(getBackground());
65
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
66 55
 			
67
-		add(infoLabel, BorderLayout.CENTER);
56
+		add(infoLabel, "grow");
68 57
 	}
69 58
 }

+ 5
- 4
src/com/dmdirc/ui/swing/components/ColourChooser.java Vedi File

@@ -24,7 +24,6 @@ package com.dmdirc.ui.swing.components;
24 24
 
25 25
 import com.dmdirc.ui.messages.ColourManager;
26 26
 import com.dmdirc.ui.swing.UIUtilities;
27
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
28 27
 
29 28
 import java.awt.BorderLayout;
30 29
 import java.awt.Color;
@@ -38,6 +37,8 @@ import javax.swing.JButton;
38 37
 import javax.swing.JPanel;
39 38
 import javax.swing.event.EventListenerList;
40 39
 
40
+import net.miginfocom.swing.MigLayout;
41
+
41 42
 /**
42 43
  * Colour chooser widget.
43 44
  */
@@ -108,10 +109,10 @@ public final class ColourChooser extends JPanel implements ActionListener {
108 109
         previewPanel.setPreferredSize(new Dimension(40, 10));
109 110
         previewPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
110 111
         
111
-        setLayout(new BorderLayout(SMALL_BORDER, SMALL_BORDER));
112
+        setLayout(new MigLayout("ins 0, fill"));
112 113
         
113
-        add(editButton, BorderLayout.LINE_END);
114
-        add(previewPanel, BorderLayout.CENTER);
114
+        add(previewPanel, "growx, pushx, sgy all");
115
+        add(editButton, "sgy all");
115 116
         
116 117
         updateColour(initialColour);
117 118
     }

+ 6
- 5
src/com/dmdirc/ui/swing/components/OptionalColourChooser.java Vedi File

@@ -25,7 +25,6 @@ package com.dmdirc.ui.swing.components;
25 25
 import com.dmdirc.ui.messages.ColourManager;
26 26
 import com.dmdirc.util.ListenerList;
27 27
 import com.dmdirc.ui.swing.UIUtilities;
28
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
29 28
 
30 29
 import java.awt.BorderLayout;
31 30
 import java.awt.Color;
@@ -39,6 +38,8 @@ import javax.swing.JButton;
39 38
 import javax.swing.JCheckBox;
40 39
 import javax.swing.JPanel;
41 40
 
41
+import net.miginfocom.swing.MigLayout;
42
+
42 43
 /**
43 44
  * Colour chooser widget.
44 45
  */
@@ -116,11 +117,11 @@ public final class OptionalColourChooser extends JPanel implements ActionListene
116 117
         enabled.setSelected(initialState);
117 118
         enabled.addActionListener(this);
118 119
         
119
-        this.setLayout(new BorderLayout(SMALL_BORDER, SMALL_BORDER));
120
+        setLayout(new MigLayout("fill, ins 0"));
120 121
         
121
-        this.add(enabled, BorderLayout.LINE_START);
122
-        this.add(previewPanel, BorderLayout.CENTER);
123
-        this.add(editButton, BorderLayout.LINE_END);
122
+        add(enabled, "sgy all");
123
+        add(previewPanel, "growx, pushx, sgy all");
124
+        add(editButton, "sgy all");
124 125
         
125 126
         updateColour(initialColour);
126 127
     }

+ 4
- 4
src/com/dmdirc/ui/swing/components/ParamModePanel.java Vedi File

@@ -33,9 +33,10 @@ import javax.swing.JCheckBox;
33 33
 import javax.swing.JComponent;
34 34
 import javax.swing.JPanel;
35 35
 import javax.swing.JTextField;
36
-import javax.swing.SpringLayout;
37 36
 import com.dmdirc.ui.swing.UIUtilities;
38 37
 
38
+import net.miginfocom.swing.MigLayout;
39
+
39 40
 /**
40 41
  * A component to encapsulate one parameter-requiring channel mode, displaying
41 42
  * the user a checkbox, the mode's name, and a text field.
@@ -78,8 +79,7 @@ public final class ParamModePanel extends JPanel implements ActionListener {
78 79
                 tooltip = "Mode " + mode + ": Unknown";
79 80
             }
80 81
         
81
-        final SpringLayout layout = new SpringLayout();
82
-        setLayout(layout);
82
+        setLayout(new MigLayout("fill"));
83 83
         
84 84
         text = "Mode " + mode + ": ";
85 85
         
@@ -95,7 +95,7 @@ public final class ParamModePanel extends JPanel implements ActionListener {
95 95
         
96 96
         textField = new JTextField(value);
97 97
         textField.setInputVerifier(new ModeParameterVerifier());
98
-        add(textField);
98
+        add(textField, "growx, pushx");
99 99
         
100 100
         if (!state) {
101 101
             textField.setEnabled(false);

+ 6
- 5
src/com/dmdirc/ui/swing/components/renderers/ReorderableJListCellRenderer.java Vedi File

@@ -24,7 +24,6 @@ package com.dmdirc.ui.swing.components.renderers;
24 24
 
25 25
 import com.dmdirc.ui.swing.components.reorderablelist.ReorderableJList;
26 26
 
27
-import java.awt.BorderLayout;
28 27
 import java.awt.Component;
29 28
 
30 29
 import javax.swing.JLabel;
@@ -34,6 +33,8 @@ import javax.swing.JSeparator;
34 33
 import javax.swing.ListCellRenderer;
35 34
 import javax.swing.UIManager;
36 35
 
36
+import net.miginfocom.swing.MigLayout;
37
+
37 38
 /**
38 39
  * Renderer for the reorderable JList, procides visual clues to DnD.
39 40
  */
@@ -66,12 +67,12 @@ public class ReorderableJListCellRenderer implements ListCellRenderer {
66 67
             final Object value, final int index, final boolean isSelected,
67 68
             final boolean cellHasFocus) {
68 69
         final JPanel panel = new JPanel();
69
-        panel.setLayout(new BorderLayout());
70
+        panel.setLayout(new MigLayout("fill, ins 0"));
70 71
         final boolean isTargetCell = value == parent.getTargetCell();
71 72
         
72 73
         final boolean showSelected = isSelected & (parent.getTargetCell() == null);
73 74
         
74
-        panel.add(new JLabel(value.toString()), BorderLayout.CENTER);
75
+        panel.add(new JLabel(value.toString()), "dock center");
75 76
         
76 77
         if (showSelected) {
77 78
             panel.setForeground(UIManager.getColor("List.selectionForeground"));
@@ -89,9 +90,9 @@ public class ReorderableJListCellRenderer implements ListCellRenderer {
89 90
         
90 91
         if (isTargetCell) {
91 92
             if (parent.getBelowTarget()) {
92
-                panel.add(new JSeparator(), BorderLayout.PAGE_END);
93
+                panel.add(new JSeparator(), "dock south");
93 94
             } else {
94
-                panel.add(new JSeparator(), BorderLayout.PAGE_START);
95
+                panel.add(new JSeparator(), "dock north");
95 96
             }
96 97
         }
97 98
         

+ 103
- 123
src/com/dmdirc/ui/swing/dialogs/error/FatalErrorDialog.java Vedi File

@@ -26,14 +26,8 @@ import com.dmdirc.ui.IconManager;
26 26
 import com.dmdirc.Main;
27 27
 import com.dmdirc.logger.ErrorReportStatus;
28 28
 import com.dmdirc.logger.ProgramError;
29
-import static com.dmdirc.ui.swing.UIUtilities.LARGE_BORDER;
30
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
31 29
 import com.dmdirc.ui.swing.components.TextLabel;
32 30
 
33
-import java.awt.Dimension;
34
-import java.awt.GridBagConstraints;
35
-import java.awt.GridBagLayout;
36
-import java.awt.Insets;
37 31
 import java.awt.event.ActionEvent;
38 32
 import java.awt.event.ActionListener;
39 33
 import java.awt.event.WindowEvent;
@@ -41,7 +35,7 @@ import java.awt.event.WindowListener;
41 35
 import java.util.Timer;
42 36
 import java.util.TimerTask;
43 37
 
44
-import javax.swing.Box;
38
+import javax.swing.ImageIcon;
45 39
 import javax.swing.JButton;
46 40
 import javax.swing.JDialog;
47 41
 import javax.swing.JLabel;
@@ -49,39 +43,36 @@ import javax.swing.JScrollPane;
49 43
 import javax.swing.JTextArea;
50 44
 import javax.swing.WindowConstants;
51 45
 
46
+import net.miginfocom.swing.MigLayout;
47
+
52 48
 /**
53 49
  * The fatal error dialog is used to inform the user that a fatal error has
54 50
  * occured.
55
- * @author chris
56 51
  */
57 52
 public final class FatalErrorDialog extends JDialog implements ActionListener,
58 53
         WindowListener {
59
-    
54
+
60 55
     /**
61 56
      * A version number for this class. It should be changed whenever the class
62 57
      * structure is changed (or anything else that would prevent serialized
63 58
      * objects being unserialized with the new class).
64 59
      */
65
-    private static final long serialVersionUID = 2;
66
-    
60
+    private static final long serialVersionUID = 3;
67 61
     /** error. */
68 62
     private final ProgramError error;
69
-    
70 63
     /** button. */
71 64
     private JButton okButton;
72
-    
73 65
     /** label. */
74
-    private JLabel infoLabel;
75
-    
66
+    private TextLabel infoLabel;
67
+    /** Icon. */
68
+    private ImageIcon icon;
76 69
     /** label. */
77 70
     private TextLabel messageLabel;
78
-    
79 71
     /** label. */
80 72
     private JButton showMore;
81
-    
82 73
     /** stack trace scroll pane. */
83 74
     private JScrollPane scrollPane;
84
-    
75
+
85 76
     /**
86 77
      * Creates a new fatal error dialog.
87 78
      *
@@ -89,48 +80,47 @@ public final class FatalErrorDialog extends JDialog implements ActionListener,
89 80
      */
90 81
     public FatalErrorDialog(final ProgramError error) {
91 82
         super();
92
-        
83
+
93 84
         setModal(true);
94
-        
85
+
95 86
         this.error = error;
96
-        
87
+
97 88
         initComponents();
98 89
         layoutComponents();
99
-        
90
+
100 91
         setLocationRelativeTo(getParent());
92
+        setResizable(false);
101 93
         setVisible(true);
102 94
     }
103
-    
95
+
104 96
     /**
105 97
      * Initialises the components for this dialog.
106 98
      */
107 99
     private void initComponents() {
108 100
         final JTextArea stacktraceField = new JTextArea();
109
-        
101
+
110 102
         messageLabel = new TextLabel();
111
-        infoLabel = new JLabel();
103
+        infoLabel = new TextLabel();
112 104
         showMore = new JButton();
113 105
         scrollPane = new JScrollPane();
114 106
         okButton = new JButton();
115
-        
107
+
116 108
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
117
-        
118 109
         setTitle("DMDirc: Error");
119
-        
120
-        infoLabel.setText("DMDirc has encountered a fatal error, and is "
121
-                + "not able to recover. The application will now terminate.");
122
-        
123
-        infoLabel.setIcon(IconManager.getIconManager().getIcon("error"));
124
-        
110
+        setIconImage(IconManager.getIconManager().getImage("icon"));
111
+
112
+        infoLabel.setText("DMDirc has encountered a fatal error, and is " +
113
+                "not able to recover. The application will now terminate.");
114
+
115
+        icon = new ImageIcon(IconManager.getIconManager().getImage("error"));
116
+
125 117
         messageLabel.setText("Description: \n" + error.getMessage());
126
-        
118
+
127 119
         showMore.setText("Show details");
128 120
         showMore.addActionListener(this);
129
-        
130
-        stacktraceField.setColumns(20);
121
+
131 122
         stacktraceField.setEditable(false);
132
-        stacktraceField.setRows(5);
133
-        
123
+
134 124
         final String[] trace = error.getTrace();
135 125
         if (trace.length > 0) {
136 126
             for (String line : trace) {
@@ -138,148 +128,138 @@ public final class FatalErrorDialog extends JDialog implements ActionListener,
138 128
             }
139 129
             stacktraceField.setCaretPosition(0);
140 130
         }
141
-        
131
+
142 132
         scrollPane.setViewportView(stacktraceField);
143
-        scrollPane.setMinimumSize(new Dimension(600, 200));
144
-        scrollPane.setPreferredSize(new Dimension(600, 200));
145 133
         scrollPane.setVisible(false);
146
-        
134
+
147 135
         okButton.setText("OK");
148
-        okButton.setPreferredSize(new Dimension(100, 25));
149
-        
136
+
150 137
         okButton.addActionListener(this);
151 138
         addWindowListener(this);
152 139
     }
153
-    
140
+
154 141
     /**
155 142
      * lays the components out in the dialog.
156 143
      */
157 144
     private void layoutComponents() {
158
-        final GridBagConstraints constraints = new GridBagConstraints();
159
-        
160
-        getContentPane().setLayout(new GridBagLayout());
161
-        
162
-        constraints.gridx = 0;
163
-        constraints.gridy = 0;
164
-        constraints.gridwidth = 3;
165
-        constraints.weightx = 1.0;
166
-        constraints.weighty = 0.0;
167
-        constraints.fill = GridBagConstraints.HORIZONTAL;
168
-        constraints.insets = new Insets(LARGE_BORDER, LARGE_BORDER,
169
-                LARGE_BORDER, LARGE_BORDER);
170
-        getContentPane().add(infoLabel, constraints);
171
-        
172
-        constraints.insets = new Insets(0, LARGE_BORDER, SMALL_BORDER,
173
-                LARGE_BORDER);
174
-        constraints.gridy = 1;
175
-        getContentPane().add(messageLabel, constraints);
176
-        
177
-        constraints.insets = new Insets(0, LARGE_BORDER, SMALL_BORDER,
178
-                LARGE_BORDER);
179
-        constraints.gridx = 0;
180
-        constraints.gridy = 2;
181
-        constraints.gridwidth = 3;
182
-        getContentPane().add(showMore, constraints);
183
-        
184
-        constraints.insets = new Insets(0, LARGE_BORDER, 0, LARGE_BORDER);
185
-        constraints.gridx = 0;
186
-        constraints.gridwidth = 3;
187
-        constraints.weightx = 1.0;
188
-        constraints.weighty = 1.0;
189
-        constraints.gridy = 3;
190
-        constraints.fill = GridBagConstraints.BOTH;
191
-        getContentPane().add(scrollPane, constraints);
192
-        
193
-        constraints.insets = new Insets(0, LARGE_BORDER, SMALL_BORDER,
194
-                LARGE_BORDER);
195
-        constraints.weightx = 0.0;
196
-        constraints.weighty = 0.0;
197
-        constraints.gridx = 0;
198
-        constraints.gridy = 4;
199
-        constraints.gridwidth = 1;
200
-        constraints.fill = GridBagConstraints.HORIZONTAL;
201
-        getContentPane().add(Box.createHorizontalGlue(), constraints);
202
-        
203
-        constraints.insets.set(LARGE_BORDER, LARGE_BORDER, LARGE_BORDER,
204
-                LARGE_BORDER);
205
-        constraints.gridx = 2;
206
-        constraints.anchor = GridBagConstraints.EAST;
207
-        constraints.fill = GridBagConstraints.NONE;
208
-        getContentPane().add(okButton, constraints);
145
+        getContentPane().setLayout(new MigLayout("wrap 1, hidemode 3, wmin 600, wmax 600, pack"));
146
+        getContentPane().add(new JLabel(icon), "growx, split 2");
147
+        getContentPane().add(infoLabel, "growx");
148
+        getContentPane().add(messageLabel, "growx");
149
+        getContentPane().add(showMore, "growx");
150
+        getContentPane().add(scrollPane, "grow, hmin 200, hmax 200");
151
+        getContentPane().add(okButton, "right, tag ok");
209 152
         pack();
210 153
     }
211
-    
154
+
212 155
     /**
213 156
      * Exits the program. {@inheritDoc}
157
+     * 
158
+     * @param actionEvent Action event.
214 159
      */
160
+    @Override
215 161
     public void actionPerformed(final ActionEvent actionEvent) {
216 162
         if (actionEvent.getSource() == showMore) {
217 163
             if (showMore.getText().equals("Show details")) {
218 164
                 scrollPane.setVisible(true);
219 165
                 showMore.setText("Hide details");
220
-                pack();
221
-                setLocationRelativeTo(getParent());
222 166
             } else {
223 167
                 scrollPane.setVisible(false);
224 168
                 showMore.setText("Show details");
225
-                pack();
226
-                setLocationRelativeTo(getParent());
227 169
             }
228 170
         } else {
229 171
             closeDialog();
230 172
         }
231 173
     }
232
-    
174
+
233 175
     /** Closes the dialog, and the client. */
234 176
     public void closeDialog() {
235 177
         dispose();
236 178
         new Timer("Fatal Error Dialog Timer").schedule(new TimerTask() {
179
+
180
+            /** {@inheritDoc} */
181
+            @Override
237 182
             public void run() {
238 183
                 Main.getUI().getMainWindow().setVisible(false);
239 184
                 while (error.getReportStatus() != ErrorReportStatus.FINISHED) {
240 185
                     try {
241 186
                         Thread.sleep(1000);
242 187
                     } catch (InterruptedException ex) {
243
-                        //Ignore
188
+                    //Ignore
244 189
                     }
245 190
                 }
246 191
                 System.exit(-1);
247 192
             }
248 193
         }, 0);
249 194
     }
250
-    
251
-    /** {@inheritDoc} */
195
+
196
+    /** 
197
+     * {@inheritDoc}
198
+     * 
199
+     * @param e Window event
200
+     */
201
+    @Override
252 202
     public void windowOpened(final WindowEvent e) {
253
-        //ignore
203
+    //ignore
254 204
     }
255
-    
256
-    /** {@inheritDoc} */
205
+
206
+    /** 
207
+     * {@inheritDoc}
208
+     * 
209
+     * @param e Window event
210
+     */
211
+    @Override
257 212
     public void windowClosing(final WindowEvent e) {
258 213
         closeDialog();
259 214
     }
260
-    
261
-    /** {@inheritDoc} */
215
+
216
+    /** 
217
+     * {@inheritDoc}
218
+     * 
219
+     * @param e Window event
220
+     */
221
+    @Override
262 222
     public void windowClosed(final WindowEvent e) {
263
-        //ignore
223
+    //ignore
264 224
     }
265
-    
266
-    /** {@inheritDoc} */
225
+
226
+    /** 
227
+     * {@inheritDoc}
228
+     * 
229
+     * @param e Window event
230
+     */
231
+    @Override
267 232
     public void windowIconified(final WindowEvent e) {
268
-        //ignore
233
+    //ignore
269 234
     }
270
-    
271
-    /** {@inheritDoc} */
235
+
236
+    /** 
237
+     * {@inheritDoc}
238
+     * 
239
+     * @param e Window event
240
+     */
241
+    @Override
272 242
     public void windowDeiconified(final WindowEvent e) {
273
-        //ignore
243
+    //ignore
274 244
     }
275
-    
276
-    /** {@inheritDoc} */
245
+
246
+    /** 
247
+     * {@inheritDoc}
248
+     * 
249
+     * @param e Window event
250
+     */
251
+    @Override
277 252
     public void windowActivated(final WindowEvent e) {
278
-        //ignore
253
+    //ignore
279 254
     }
280
-    
281
-    /** {@inheritDoc} */
255
+
256
+    /** 
257
+     * {@inheritDoc}
258
+     * 
259
+     * @param e Window event
260
+     */
261
+    @Override
282 262
     public void windowDeactivated(final WindowEvent e) {
283
-        //ignore
263
+    //ignore
284 264
     }
285 265
 }

+ 5
- 8
src/com/dmdirc/ui/swing/dialogs/serversetting/PerformPanel.java Vedi File

@@ -26,19 +26,18 @@ import com.dmdirc.Server;
26 26
 import com.dmdirc.actions.Action;
27 27
 import com.dmdirc.actions.wrappers.PerformWrapper;
28 28
 import com.dmdirc.ui.swing.UIUtilities;
29
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
30 29
 
31
-import java.awt.BorderLayout;
32 30
 import java.awt.event.ActionEvent;
33 31
 import java.awt.event.ActionListener;
34 32
 
35
-import javax.swing.BorderFactory;
36 33
 import javax.swing.DefaultComboBoxModel;
37 34
 import javax.swing.JComboBox;
38 35
 import javax.swing.JPanel;
39 36
 import javax.swing.JScrollPane;
40 37
 import javax.swing.JTextArea;
41 38
 
39
+import net.miginfocom.swing.MigLayout;
40
+
42 41
 /**
43 42
  * Perform panel.
44 43
  */
@@ -92,9 +91,7 @@ public final class PerformPanel extends JPanel implements ActionListener {
92 91
     
93 92
     /** Initialises teh components. */
94 93
     private void initComponents() {
95
-        setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER, SMALL_BORDER, 
96
-                SMALL_BORDER, SMALL_BORDER));
97
-        setLayout(new BorderLayout(SMALL_BORDER, SMALL_BORDER));
94
+        setLayout(new MigLayout("fill"));
98 95
         
99 96
         final DefaultComboBoxModel model = new DefaultComboBoxModel();
100 97
         target = new JComboBox(model);
@@ -106,12 +103,12 @@ public final class PerformPanel extends JPanel implements ActionListener {
106 103
             model.addElement("Server perform (" + server.getName() + ")");
107 104
         }
108 105
         
109
-        add(target, BorderLayout.NORTH);
106
+        add(target, "growx, pushx, wrap");
110 107
         
111 108
         textarea = new JTextArea();
112 109
         textarea.setColumns(40);
113 110
         
114
-        add(new JScrollPane(textarea));
111
+        add(new JScrollPane(textarea), "grow");
115 112
     }
116 113
     
117 114
     /** Adds listeners to the components. */

+ 13
- 27
src/com/dmdirc/ui/swing/dialogs/serversetting/ServerSettingsDialog.java Vedi File

@@ -29,7 +29,6 @@ import com.dmdirc.ui.swing.MainFrame;
29 29
 import com.dmdirc.ui.swing.components.StandardDialog;
30 30
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel;
31 31
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel.OptionType;
32
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
33 32
 
34 33
 import java.awt.BorderLayout;
35 34
 import java.awt.event.ActionEvent;
@@ -42,6 +41,8 @@ import javax.swing.JButton;
42 41
 import javax.swing.JPanel;
43 42
 import javax.swing.JTabbedPane;
44 43
 
44
+import net.miginfocom.swing.MigLayout;
45
+
45 46
 /**
46 47
  * Allows the user to modify server settings and the ignore list.
47 48
  */
@@ -111,7 +112,7 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
111 112
      */
112 113
     public static synchronized ServerSettingsDialog getServerSettingsDialog(final Server server) {
113 114
         if (me == null) {
114
-            me =    new ServerSettingsDialog(server);
115
+            me = new ServerSettingsDialog(server);
115 116
         }
116 117
 
117 118
         me.pack();
@@ -122,13 +123,9 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
122 123
     /** Initialises the main UI components. */
123 124
     private void initComponents() {
124 125
         orderButtons(new JButton(), new JButton());
125
-        initButtonsPanel();
126 126
 
127 127
         tabbedPane = new JTabbedPane();
128 128
 
129
-        tabbedPane.setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER,
130
-                SMALL_BORDER, 0, SMALL_BORDER));
131
-        
132 129
         modesPanel = new UserModesPane(server);
133 130
 
134 131
         ignoreList =
@@ -154,10 +151,11 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
154 151
             tabbedPane.add("Settings", settingsPanel);
155 152
         }
156 153
 
157
-        setLayout(new BorderLayout());
154
+        setLayout(new MigLayout("fill, wrap 1"));
158 155
 
159
-        add(tabbedPane, BorderLayout.CENTER);
160
-        add(buttonsPanel, BorderLayout.PAGE_END);
156
+        add(tabbedPane, "grow");
157
+        add(getLeftButton(), "split 2, right");
158
+        add(getRightButton(), "right");
161 159
 
162 160
         tabbedPane.setSelectedIndex(server.getConfigManager().
163 161
                 getOptionInt("dialogstate", "serversettingsdialog", 0));
@@ -231,22 +229,6 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
231 229
         settingsPanel.addOption("general.pingtimeout", "Ping timeout",
232 230
                 OptionType.SPINNER);
233 231
     }
234
-
235
-    /** Initialises the button panel. */
236
-    private void initButtonsPanel() {
237
-        buttonsPanel = new JPanel();
238
-
239
-        buttonsPanel.setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER,
240
-                SMALL_BORDER, SMALL_BORDER, SMALL_BORDER));
241
-
242
-        buttonsPanel.setLayout(new BoxLayout(buttonsPanel,
243
-                BoxLayout.LINE_AXIS));
244
-        buttonsPanel.add(Box.createHorizontalGlue());
245
-        buttonsPanel.add(getLeftButton());
246
-        buttonsPanel.add(Box.createHorizontalStrut(SMALL_BORDER));
247
-        buttonsPanel.add(getRightButton());
248
-    }
249
-
250 232
     /** Initialises listeners for this dialog. */
251 233
     private void initListeners() {
252 234
         getOkButton().addActionListener(this);
@@ -265,7 +247,11 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
265 247
                 String.valueOf(tabbedPane.getSelectedIndex()));
266 248
     }
267 249
 
268
-    /** {@inheritDoc} */
250
+    /**
251
+     * {@inheritDoc}
252
+     * 
253
+     * @param e Action event
254
+     */
269 255
     @Override
270 256
     public void actionPerformed(final ActionEvent e) {
271 257
         if (e.getSource() == getOkButton()) {
@@ -284,4 +270,4 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
284 270
             me = null;
285 271
         }
286 272
     }
287
-}
273
+}

+ 11
- 42
src/com/dmdirc/ui/swing/framemanager/buttonbar/ButtonBar.java Vedi File

@@ -35,11 +35,8 @@ import com.dmdirc.ui.interfaces.Window;
35 35
 import com.dmdirc.ui.swing.UIUtilities;
36 36
 import com.dmdirc.util.MapList;
37 37
 
38
-import java.awt.BorderLayout;
39 38
 import java.awt.Color;
40 39
 import java.awt.Dimension;
41
-import java.awt.GridBagConstraints;
42
-import java.awt.GridBagLayout;
43 40
 import java.awt.Insets;
44 41
 import java.awt.event.ActionEvent;
45 42
 import java.awt.event.ActionListener;
@@ -51,13 +48,14 @@ import java.util.HashMap;
51 48
 import java.util.List;
52 49
 import java.util.Map;
53 50
 
54
-import javax.swing.BorderFactory;
55 51
 import javax.swing.Icon;
56 52
 import javax.swing.JComponent;
57 53
 import javax.swing.JPanel;
58 54
 import javax.swing.JToggleButton;
59 55
 import javax.swing.SwingConstants;
60 56
 
57
+import net.miginfocom.swing.MigLayout;
58
+
61 59
 /**
62 60
  * The button bar manager is a grid of buttons that presents a manager similar
63 61
  * to that used by mIRC.
@@ -109,7 +107,11 @@ public final class ButtonBar implements FrameManager, ActionListener,
109 107
         position = FramemanagerPosition.getPosition(
110 108
                 IdentityManager.getGlobalConfig().getOption("ui", "framemanagerPosition"));
111 109
         
112
-        panel = new JPanel(new GridBagLayout());
110
+        if (position.isHorizontal()) {
111
+            panel = new JPanel(new MigLayout("ins 0, fill, flowx"));
112
+        } else {
113
+             panel = new JPanel(new MigLayout("ins 0, fill, flowy"));
114
+        }
113 115
     }
114 116
     
115 117
     /** {@inheritDoc} */
@@ -117,11 +119,8 @@ public final class ButtonBar implements FrameManager, ActionListener,
117 119
     public void setParent(final JComponent parent) {
118 120
         this.parent = parent;
119 121
         
120
-        parent.setLayout(new BorderLayout());
121
-        parent.setBorder(BorderFactory.createEmptyBorder(
122
-                UIUtilities.SMALL_BORDER, UIUtilities.SMALL_BORDER,
123
-                UIUtilities.SMALL_BORDER, UIUtilities.SMALL_BORDER));
124
-        parent.add(panel, BorderLayout.NORTH);
122
+        parent.setLayout(new MigLayout());
123
+        parent.add(panel);
125 124
         
126 125
         buttonWidth = position.isHorizontal() ? 150 : (parent.getWidth() 
127 126
                 - UIUtilities.SMALL_BORDER * 3) / cells;
@@ -139,52 +138,22 @@ public final class ButtonBar implements FrameManager, ActionListener,
139 138
     private void relayout() {
140 139
         panel.removeAll();
141 140
         
142
-        final GridBagConstraints constraints = new GridBagConstraints();
143
-        constraints.gridx = 0;
144
-        constraints.gridy = 0;
145
-        constraints.insets.set(UIUtilities.SMALL_BORDER,
146
-                UIUtilities.SMALL_BORDER, 0, 0);
147
-        
148 141
         for (Map.Entry<FrameContainer, List<FrameContainer>> entry : windows.entrySet()) {
149 142
             buttons.get(entry.getKey()).setPreferredSize(new Dimension(buttonWidth, 25));
150 143
             buttons.get(entry.getKey()).setMinimumSize(new Dimension(buttonWidth, 25));
151
-            panel.add(buttons.get(entry.getKey()), constraints);
152
-            increment(constraints);
144
+            panel.add(buttons.get(entry.getKey()));
153 145
             
154 146
             Collections.sort(entry.getValue(), new FrameContainerComparator());
155 147
             
156 148
             for (FrameContainer child : entry.getValue()) {
157 149
                 buttons.get(child).setPreferredSize(new Dimension(buttonWidth, 25));
158 150
                 buttons.get(child).setMinimumSize(new Dimension(buttonWidth, 25));
159
-                panel.add(buttons.get(child), constraints);
160
-                increment(constraints);
151
+                panel.add(buttons.get(child));
161 152
             }
162 153
         }
163 154
         panel.validate();
164 155
     }
165 156
     
166
-    /**
167
-     * Increments the x and y offsets (where appropriate) of the gridbag
168
-     * constraints.
169
-     *
170
-     * @param constraints The constraints to modify
171
-     */
172
-    public void increment(final GridBagConstraints constraints) {
173
-        if (position.isHorizontal()) {
174
-            constraints.gridx++;
175
-            if (constraints.gridx > maxButtons) {
176
-                constraints.gridy++;
177
-                constraints.gridx = 0;
178
-            }
179
-        } else {
180
-            constraints.gridy++;
181
-            if (constraints.gridy > maxButtons) {
182
-                constraints.gridx++;
183
-                constraints.gridy = 0;
184
-            }
185
-        }
186
-    }
187
-    
188 157
     /**
189 158
      * Adds a button to the button array with the details from the specified
190 159
      * container.

+ 3
- 3
src/com/dmdirc/ui/swing/framemanager/tree/TreeFrameManager.java Vedi File

@@ -36,7 +36,6 @@ import com.dmdirc.ui.swing.actions.CloseFrameContainerAction;
36 36
 import com.dmdirc.ui.swing.components.TextFrame;
37 37
 import com.dmdirc.ui.swing.components.TreeScroller;
38 38
 
39
-import java.awt.BorderLayout;
40 39
 import java.awt.Color;
41 40
 import java.awt.Rectangle;
42 41
 import java.awt.event.AdjustmentEvent;
@@ -66,6 +65,7 @@ import javax.swing.tree.TreePath;
66 65
 import javax.swing.tree.TreeSelectionModel;
67 66
 
68 67
 import net.miginfocom.layout.PlatformDefaults;
68
+import net.miginfocom.swing.MigLayout;
69 69
 
70 70
 /**
71 71
  * Manages open windows in the application in a tree style view.
@@ -170,8 +170,8 @@ public final class TreeFrameManager implements FrameManager, MouseListener,
170 170
                 scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
171 171
                 scrollPane.getHorizontalScrollBar().addAdjustmentListener(TreeFrameManager.this);
172 172
 
173
-                parent.setLayout(new BorderLayout());
174
-                parent.add(scrollPane);
173
+                parent.setLayout(new MigLayout("ins 0, fill"));
174
+                parent.add(scrollPane, "grow");
175 175
                 parent.setFocusable(false);
176 176
 
177 177
                 setColours();

+ 4
- 3
src/com/dmdirc/ui/swing/textpane/TextPane.java Vedi File

@@ -56,6 +56,7 @@ import javax.swing.text.StyleConstants.CharacterConstants;
56 56
 import javax.swing.text.StyleConstants.ColorConstants;
57 57
 import javax.swing.text.StyleConstants.FontConstants;
58 58
 import javax.swing.text.StyledDocument;
59
+import net.miginfocom.swing.MigLayout;
59 60
 
60 61
 /**
61 62
  * Styled, scrollable text pane.
@@ -105,17 +106,17 @@ public final class TextPane extends JComponent implements AdjustmentListener,
105 106
 
106 107
         setMinimumSize(new Dimension(0, 0));
107 108
 
108
-        setLayout(new BorderLayout());
109
+        setLayout(new MigLayout("fill"));
109 110
 
110 111
         canvas = new TextPaneCanvas(this, document);
111 112
 
112 113
         setBorder(UIManager.getBorder("TextField.border"));
113 114
 
114
-        add(canvas, BorderLayout.CENTER);
115
+        add(canvas, "dock center");
115 116
 
116 117
 
117 118
         scrollBar = new JScrollBar(JScrollBar.VERTICAL);
118
-        add(scrollBar, BorderLayout.LINE_END);
119
+        add(scrollBar, "dock east");
119 120
 
120 121
         setAutoscrolls(true);
121 122
 

Loading…
Annulla
Salva