소스 검색

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 년 전
부모
커밋
f29b39e083

+ 4
- 9
src/com/dmdirc/addons/osdplugin/OsdWindow.java 파일 보기

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

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

+ 3
- 9
src/com/dmdirc/installer/StepConfirm.java 파일 보기

27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
29
 import com.dmdirc.ui.swing.dialogs.wizard.WizardFrame;
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
  * This confirms the settings chosen in the previous step
34
  * This confirms the settings chosen in the previous step
55
 	public StepConfirm(final WizardFrame dialog) {
51
 	public StepConfirm(final WizardFrame dialog) {
56
 		super();
52
 		super();
57
 		dialog.addStepListener(this);
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
 		infoLabel.setOpaque(false);
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
 	/** {@inheritDoc} */
61
 	/** {@inheritDoc} */

+ 3
- 9
src/com/dmdirc/installer/StepError.java 파일 보기

24
 
24
 
25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
26
 import com.dmdirc.ui.swing.components.TextLabel;
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
  * This step shows an unable to install error
31
  * This step shows an unable to install error
56
 	 */
52
 	 */
57
 	public StepError(final String message) {
53
 	public StepError(final String message) {
58
 		super();
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
 		TextLabel infoLabel;
57
 		TextLabel infoLabel;
63
 		infoLabel = new TextLabel(message);
58
 		infoLabel = new TextLabel(message);
64
 		infoLabel.setOpaque(false);
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 파일 보기

27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
28
 import com.dmdirc.ui.swing.dialogs.wizard.StepListener;
29
 import com.dmdirc.ui.swing.dialogs.wizard.WizardFrame;
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
 import javax.swing.UIManager;
31
 import javax.swing.UIManager;
35
 
32
 
36
-import javax.swing.BorderFactory;
37
 import javax.swing.JTextArea;
33
 import javax.swing.JTextArea;
38
 import javax.swing.JScrollPane;
34
 import javax.swing.JScrollPane;
39
 
35
 
36
+import net.miginfocom.swing.MigLayout;
37
+
40
 /**
38
 /**
41
  * This confirms the settings chosen in the previous step
39
  * This confirms the settings chosen in the previous step
42
  */
40
  */
61
 	public StepInstall(final WizardFrame dialog) {
59
 	public StepInstall(final WizardFrame dialog) {
62
 		super();
60
 		super();
63
 		dialog.addStepListener(this);
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
 		infoLabel.setFont(UIManager.getFont("Label.font"));
64
 		infoLabel.setFont(UIManager.getFont("Label.font"));
68
 		infoLabel.setEditable(false);
65
 		infoLabel.setEditable(false);
69
 		infoLabel.setWrapStyleWord(true);
66
 		infoLabel.setWrapStyleWord(true);
70
 		infoLabel.setLineWrap(true);
67
 		infoLabel.setLineWrap(true);
71
-		infoLabel.setHighlighter(null);
68
+		//infoLabel.setHighlighter(null);
72
 		infoLabel.setOpaque(false);
69
 		infoLabel.setOpaque(false);
73
 		infoLabel.setFont(UIManager.getFont("TextField.font"));
70
 		infoLabel.setFont(UIManager.getFont("TextField.font"));
74
 //		infoLabel.setBackground(getBackground());
71
 //		infoLabel.setBackground(getBackground());
75
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
76
 
72
 
77
 		scrollPane = new JScrollPane(infoLabel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
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 파일 보기

26
 import com.dmdirc.installer.Installer.ShortcutType;
26
 import com.dmdirc.installer.Installer.ShortcutType;
27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
27
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
28
 import com.dmdirc.ui.swing.components.TextLabel;
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
 import javax.swing.JCheckBox;
30
 import javax.swing.JCheckBox;
39
 import javax.swing.JLabel;
31
 import javax.swing.JLabel;
40
 import javax.swing.JTextField;
32
 import javax.swing.JTextField;
41
 
33
 
34
+import net.miginfocom.swing.MigLayout;
35
+
42
 /**
36
 /**
43
  * Queries the user for where to install dmdirc, and if they want to setup shortcuts
37
  * Queries the user for where to install dmdirc, and if they want to setup shortcuts
44
  */
38
  */
66
 	 */
60
 	 */
67
 	public StepSettings() {
61
 	public StepSettings() {
68
 		super();
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
 		TextLabel infoLabel;
65
 		TextLabel infoLabel;
74
 		infoLabel = new TextLabel("Here you can choose options for the install.\n");
66
 		infoLabel = new TextLabel("Here you can choose options for the install.\n");
78
 //		infoLabel.setHighlighter(null);
70
 //		infoLabel.setHighlighter(null);
79
 		infoLabel.setOpaque(false);
71
 		infoLabel.setOpaque(false);
80
 //		infoLabel.setBackground(getBackground());
72
 //		infoLabel.setBackground(getBackground());
81
-		infoLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, SMALL_BORDER, 0));
82
 
73
 
83
 		shortcutMenu.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-menu") == 0));
74
 		shortcutMenu.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-menu") == 0));
84
 		shortcutDesktop.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-desktop") == 0));
75
 		shortcutDesktop.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-desktop") == 0));
85
 		shortcutQuick.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-quicklaunch") == 0));
76
 		shortcutQuick.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-quicklaunch") == 0));
86
 		shortcutProtocol.setSelected((CLIParser.getCLIParser().getParamNumber("-no-shortcut-protocol") == 0));
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
 		if (Main.getInstaller().supportsShortcut(ShortcutType.MENU)) {
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
 		if (Main.getInstaller().supportsShortcut(ShortcutType.DESKTOP)) {
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
 		if (Main.getInstaller().supportsShortcut(ShortcutType.QUICKLAUNCH)) {
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
 		if (Main.getInstaller().supportsShortcut(ShortcutType.PROTOCOL)) {
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 파일 보기

24
 
24
 
25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
25
 import com.dmdirc.ui.swing.dialogs.wizard.Step;
26
 import com.dmdirc.ui.swing.components.TextLabel;
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
  * Tells the user what this application does
31
  * Tells the user what this application does
47
 	 */
43
 	 */
48
 	public StepWelcome(final String releaseName) {
44
 	public StepWelcome(final String releaseName) {
49
 		super();
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
 		TextLabel infoLabel;
48
 		TextLabel infoLabel;
54
 		infoLabel = new TextLabel("Welcome to the "+releaseName+" installer. This program will install DMDirc on this computer.\n\n"
49
 		infoLabel = new TextLabel("Welcome to the "+releaseName+" installer. This program will install DMDirc on this computer.\n\n"
56
 		                        + "Gregory Holmes. DMDirc is released for free under the MIT license; for more information, "
51
 		                        + "Gregory Holmes. DMDirc is released for free under the MIT license; for more information, "
57
 		                        + "please visit www.DMDirc.com.\n\n"
52
 		                        + "please visit www.DMDirc.com.\n\n"
58
 		                        + "Click \"Next\" to continue, or close this program to cancel the installation.");
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
 		infoLabel.setOpaque(false);
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 파일 보기

24
 
24
 
25
 import com.dmdirc.ui.messages.ColourManager;
25
 import com.dmdirc.ui.messages.ColourManager;
26
 import com.dmdirc.ui.swing.UIUtilities;
26
 import com.dmdirc.ui.swing.UIUtilities;
27
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
28
 
27
 
29
 import java.awt.BorderLayout;
28
 import java.awt.BorderLayout;
30
 import java.awt.Color;
29
 import java.awt.Color;
38
 import javax.swing.JPanel;
37
 import javax.swing.JPanel;
39
 import javax.swing.event.EventListenerList;
38
 import javax.swing.event.EventListenerList;
40
 
39
 
40
+import net.miginfocom.swing.MigLayout;
41
+
41
 /**
42
 /**
42
  * Colour chooser widget.
43
  * Colour chooser widget.
43
  */
44
  */
108
         previewPanel.setPreferredSize(new Dimension(40, 10));
109
         previewPanel.setPreferredSize(new Dimension(40, 10));
109
         previewPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
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
         updateColour(initialColour);
117
         updateColour(initialColour);
117
     }
118
     }

+ 6
- 5
src/com/dmdirc/ui/swing/components/OptionalColourChooser.java 파일 보기

25
 import com.dmdirc.ui.messages.ColourManager;
25
 import com.dmdirc.ui.messages.ColourManager;
26
 import com.dmdirc.util.ListenerList;
26
 import com.dmdirc.util.ListenerList;
27
 import com.dmdirc.ui.swing.UIUtilities;
27
 import com.dmdirc.ui.swing.UIUtilities;
28
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
29
 
28
 
30
 import java.awt.BorderLayout;
29
 import java.awt.BorderLayout;
31
 import java.awt.Color;
30
 import java.awt.Color;
39
 import javax.swing.JCheckBox;
38
 import javax.swing.JCheckBox;
40
 import javax.swing.JPanel;
39
 import javax.swing.JPanel;
41
 
40
 
41
+import net.miginfocom.swing.MigLayout;
42
+
42
 /**
43
 /**
43
  * Colour chooser widget.
44
  * Colour chooser widget.
44
  */
45
  */
116
         enabled.setSelected(initialState);
117
         enabled.setSelected(initialState);
117
         enabled.addActionListener(this);
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
         updateColour(initialColour);
126
         updateColour(initialColour);
126
     }
127
     }

+ 4
- 4
src/com/dmdirc/ui/swing/components/ParamModePanel.java 파일 보기

33
 import javax.swing.JComponent;
33
 import javax.swing.JComponent;
34
 import javax.swing.JPanel;
34
 import javax.swing.JPanel;
35
 import javax.swing.JTextField;
35
 import javax.swing.JTextField;
36
-import javax.swing.SpringLayout;
37
 import com.dmdirc.ui.swing.UIUtilities;
36
 import com.dmdirc.ui.swing.UIUtilities;
38
 
37
 
38
+import net.miginfocom.swing.MigLayout;
39
+
39
 /**
40
 /**
40
  * A component to encapsulate one parameter-requiring channel mode, displaying
41
  * A component to encapsulate one parameter-requiring channel mode, displaying
41
  * the user a checkbox, the mode's name, and a text field.
42
  * the user a checkbox, the mode's name, and a text field.
78
                 tooltip = "Mode " + mode + ": Unknown";
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
         text = "Mode " + mode + ": ";
84
         text = "Mode " + mode + ": ";
85
         
85
         
95
         
95
         
96
         textField = new JTextField(value);
96
         textField = new JTextField(value);
97
         textField.setInputVerifier(new ModeParameterVerifier());
97
         textField.setInputVerifier(new ModeParameterVerifier());
98
-        add(textField);
98
+        add(textField, "growx, pushx");
99
         
99
         
100
         if (!state) {
100
         if (!state) {
101
             textField.setEnabled(false);
101
             textField.setEnabled(false);

+ 6
- 5
src/com/dmdirc/ui/swing/components/renderers/ReorderableJListCellRenderer.java 파일 보기

24
 
24
 
25
 import com.dmdirc.ui.swing.components.reorderablelist.ReorderableJList;
25
 import com.dmdirc.ui.swing.components.reorderablelist.ReorderableJList;
26
 
26
 
27
-import java.awt.BorderLayout;
28
 import java.awt.Component;
27
 import java.awt.Component;
29
 
28
 
30
 import javax.swing.JLabel;
29
 import javax.swing.JLabel;
34
 import javax.swing.ListCellRenderer;
33
 import javax.swing.ListCellRenderer;
35
 import javax.swing.UIManager;
34
 import javax.swing.UIManager;
36
 
35
 
36
+import net.miginfocom.swing.MigLayout;
37
+
37
 /**
38
 /**
38
  * Renderer for the reorderable JList, procides visual clues to DnD.
39
  * Renderer for the reorderable JList, procides visual clues to DnD.
39
  */
40
  */
66
             final Object value, final int index, final boolean isSelected,
67
             final Object value, final int index, final boolean isSelected,
67
             final boolean cellHasFocus) {
68
             final boolean cellHasFocus) {
68
         final JPanel panel = new JPanel();
69
         final JPanel panel = new JPanel();
69
-        panel.setLayout(new BorderLayout());
70
+        panel.setLayout(new MigLayout("fill, ins 0"));
70
         final boolean isTargetCell = value == parent.getTargetCell();
71
         final boolean isTargetCell = value == parent.getTargetCell();
71
         
72
         
72
         final boolean showSelected = isSelected & (parent.getTargetCell() == null);
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
         if (showSelected) {
77
         if (showSelected) {
77
             panel.setForeground(UIManager.getColor("List.selectionForeground"));
78
             panel.setForeground(UIManager.getColor("List.selectionForeground"));
89
         
90
         
90
         if (isTargetCell) {
91
         if (isTargetCell) {
91
             if (parent.getBelowTarget()) {
92
             if (parent.getBelowTarget()) {
92
-                panel.add(new JSeparator(), BorderLayout.PAGE_END);
93
+                panel.add(new JSeparator(), "dock south");
93
             } else {
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 파일 보기

26
 import com.dmdirc.Main;
26
 import com.dmdirc.Main;
27
 import com.dmdirc.logger.ErrorReportStatus;
27
 import com.dmdirc.logger.ErrorReportStatus;
28
 import com.dmdirc.logger.ProgramError;
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
 import com.dmdirc.ui.swing.components.TextLabel;
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
 import java.awt.event.ActionEvent;
31
 import java.awt.event.ActionEvent;
38
 import java.awt.event.ActionListener;
32
 import java.awt.event.ActionListener;
39
 import java.awt.event.WindowEvent;
33
 import java.awt.event.WindowEvent;
41
 import java.util.Timer;
35
 import java.util.Timer;
42
 import java.util.TimerTask;
36
 import java.util.TimerTask;
43
 
37
 
44
-import javax.swing.Box;
38
+import javax.swing.ImageIcon;
45
 import javax.swing.JButton;
39
 import javax.swing.JButton;
46
 import javax.swing.JDialog;
40
 import javax.swing.JDialog;
47
 import javax.swing.JLabel;
41
 import javax.swing.JLabel;
49
 import javax.swing.JTextArea;
43
 import javax.swing.JTextArea;
50
 import javax.swing.WindowConstants;
44
 import javax.swing.WindowConstants;
51
 
45
 
46
+import net.miginfocom.swing.MigLayout;
47
+
52
 /**
48
 /**
53
  * The fatal error dialog is used to inform the user that a fatal error has
49
  * The fatal error dialog is used to inform the user that a fatal error has
54
  * occured.
50
  * occured.
55
- * @author chris
56
  */
51
  */
57
 public final class FatalErrorDialog extends JDialog implements ActionListener,
52
 public final class FatalErrorDialog extends JDialog implements ActionListener,
58
         WindowListener {
53
         WindowListener {
59
-    
54
+
60
     /**
55
     /**
61
      * A version number for this class. It should be changed whenever the class
56
      * A version number for this class. It should be changed whenever the class
62
      * structure is changed (or anything else that would prevent serialized
57
      * structure is changed (or anything else that would prevent serialized
63
      * objects being unserialized with the new class).
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
     /** error. */
61
     /** error. */
68
     private final ProgramError error;
62
     private final ProgramError error;
69
-    
70
     /** button. */
63
     /** button. */
71
     private JButton okButton;
64
     private JButton okButton;
72
-    
73
     /** label. */
65
     /** label. */
74
-    private JLabel infoLabel;
75
-    
66
+    private TextLabel infoLabel;
67
+    /** Icon. */
68
+    private ImageIcon icon;
76
     /** label. */
69
     /** label. */
77
     private TextLabel messageLabel;
70
     private TextLabel messageLabel;
78
-    
79
     /** label. */
71
     /** label. */
80
     private JButton showMore;
72
     private JButton showMore;
81
-    
82
     /** stack trace scroll pane. */
73
     /** stack trace scroll pane. */
83
     private JScrollPane scrollPane;
74
     private JScrollPane scrollPane;
84
-    
75
+
85
     /**
76
     /**
86
      * Creates a new fatal error dialog.
77
      * Creates a new fatal error dialog.
87
      *
78
      *
89
      */
80
      */
90
     public FatalErrorDialog(final ProgramError error) {
81
     public FatalErrorDialog(final ProgramError error) {
91
         super();
82
         super();
92
-        
83
+
93
         setModal(true);
84
         setModal(true);
94
-        
85
+
95
         this.error = error;
86
         this.error = error;
96
-        
87
+
97
         initComponents();
88
         initComponents();
98
         layoutComponents();
89
         layoutComponents();
99
-        
90
+
100
         setLocationRelativeTo(getParent());
91
         setLocationRelativeTo(getParent());
92
+        setResizable(false);
101
         setVisible(true);
93
         setVisible(true);
102
     }
94
     }
103
-    
95
+
104
     /**
96
     /**
105
      * Initialises the components for this dialog.
97
      * Initialises the components for this dialog.
106
      */
98
      */
107
     private void initComponents() {
99
     private void initComponents() {
108
         final JTextArea stacktraceField = new JTextArea();
100
         final JTextArea stacktraceField = new JTextArea();
109
-        
101
+
110
         messageLabel = new TextLabel();
102
         messageLabel = new TextLabel();
111
-        infoLabel = new JLabel();
103
+        infoLabel = new TextLabel();
112
         showMore = new JButton();
104
         showMore = new JButton();
113
         scrollPane = new JScrollPane();
105
         scrollPane = new JScrollPane();
114
         okButton = new JButton();
106
         okButton = new JButton();
115
-        
107
+
116
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
108
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
117
-        
118
         setTitle("DMDirc: Error");
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
         messageLabel.setText("Description: \n" + error.getMessage());
117
         messageLabel.setText("Description: \n" + error.getMessage());
126
-        
118
+
127
         showMore.setText("Show details");
119
         showMore.setText("Show details");
128
         showMore.addActionListener(this);
120
         showMore.addActionListener(this);
129
-        
130
-        stacktraceField.setColumns(20);
121
+
131
         stacktraceField.setEditable(false);
122
         stacktraceField.setEditable(false);
132
-        stacktraceField.setRows(5);
133
-        
123
+
134
         final String[] trace = error.getTrace();
124
         final String[] trace = error.getTrace();
135
         if (trace.length > 0) {
125
         if (trace.length > 0) {
136
             for (String line : trace) {
126
             for (String line : trace) {
138
             }
128
             }
139
             stacktraceField.setCaretPosition(0);
129
             stacktraceField.setCaretPosition(0);
140
         }
130
         }
141
-        
131
+
142
         scrollPane.setViewportView(stacktraceField);
132
         scrollPane.setViewportView(stacktraceField);
143
-        scrollPane.setMinimumSize(new Dimension(600, 200));
144
-        scrollPane.setPreferredSize(new Dimension(600, 200));
145
         scrollPane.setVisible(false);
133
         scrollPane.setVisible(false);
146
-        
134
+
147
         okButton.setText("OK");
135
         okButton.setText("OK");
148
-        okButton.setPreferredSize(new Dimension(100, 25));
149
-        
136
+
150
         okButton.addActionListener(this);
137
         okButton.addActionListener(this);
151
         addWindowListener(this);
138
         addWindowListener(this);
152
     }
139
     }
153
-    
140
+
154
     /**
141
     /**
155
      * lays the components out in the dialog.
142
      * lays the components out in the dialog.
156
      */
143
      */
157
     private void layoutComponents() {
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
         pack();
152
         pack();
210
     }
153
     }
211
-    
154
+
212
     /**
155
     /**
213
      * Exits the program. {@inheritDoc}
156
      * Exits the program. {@inheritDoc}
157
+     * 
158
+     * @param actionEvent Action event.
214
      */
159
      */
160
+    @Override
215
     public void actionPerformed(final ActionEvent actionEvent) {
161
     public void actionPerformed(final ActionEvent actionEvent) {
216
         if (actionEvent.getSource() == showMore) {
162
         if (actionEvent.getSource() == showMore) {
217
             if (showMore.getText().equals("Show details")) {
163
             if (showMore.getText().equals("Show details")) {
218
                 scrollPane.setVisible(true);
164
                 scrollPane.setVisible(true);
219
                 showMore.setText("Hide details");
165
                 showMore.setText("Hide details");
220
-                pack();
221
-                setLocationRelativeTo(getParent());
222
             } else {
166
             } else {
223
                 scrollPane.setVisible(false);
167
                 scrollPane.setVisible(false);
224
                 showMore.setText("Show details");
168
                 showMore.setText("Show details");
225
-                pack();
226
-                setLocationRelativeTo(getParent());
227
             }
169
             }
228
         } else {
170
         } else {
229
             closeDialog();
171
             closeDialog();
230
         }
172
         }
231
     }
173
     }
232
-    
174
+
233
     /** Closes the dialog, and the client. */
175
     /** Closes the dialog, and the client. */
234
     public void closeDialog() {
176
     public void closeDialog() {
235
         dispose();
177
         dispose();
236
         new Timer("Fatal Error Dialog Timer").schedule(new TimerTask() {
178
         new Timer("Fatal Error Dialog Timer").schedule(new TimerTask() {
179
+
180
+            /** {@inheritDoc} */
181
+            @Override
237
             public void run() {
182
             public void run() {
238
                 Main.getUI().getMainWindow().setVisible(false);
183
                 Main.getUI().getMainWindow().setVisible(false);
239
                 while (error.getReportStatus() != ErrorReportStatus.FINISHED) {
184
                 while (error.getReportStatus() != ErrorReportStatus.FINISHED) {
240
                     try {
185
                     try {
241
                         Thread.sleep(1000);
186
                         Thread.sleep(1000);
242
                     } catch (InterruptedException ex) {
187
                     } catch (InterruptedException ex) {
243
-                        //Ignore
188
+                    //Ignore
244
                     }
189
                     }
245
                 }
190
                 }
246
                 System.exit(-1);
191
                 System.exit(-1);
247
             }
192
             }
248
         }, 0);
193
         }, 0);
249
     }
194
     }
250
-    
251
-    /** {@inheritDoc} */
195
+
196
+    /** 
197
+     * {@inheritDoc}
198
+     * 
199
+     * @param e Window event
200
+     */
201
+    @Override
252
     public void windowOpened(final WindowEvent e) {
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
     public void windowClosing(final WindowEvent e) {
212
     public void windowClosing(final WindowEvent e) {
258
         closeDialog();
213
         closeDialog();
259
     }
214
     }
260
-    
261
-    /** {@inheritDoc} */
215
+
216
+    /** 
217
+     * {@inheritDoc}
218
+     * 
219
+     * @param e Window event
220
+     */
221
+    @Override
262
     public void windowClosed(final WindowEvent e) {
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
     public void windowIconified(final WindowEvent e) {
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
     public void windowDeiconified(final WindowEvent e) {
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
     public void windowActivated(final WindowEvent e) {
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
     public void windowDeactivated(final WindowEvent e) {
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 파일 보기

26
 import com.dmdirc.actions.Action;
26
 import com.dmdirc.actions.Action;
27
 import com.dmdirc.actions.wrappers.PerformWrapper;
27
 import com.dmdirc.actions.wrappers.PerformWrapper;
28
 import com.dmdirc.ui.swing.UIUtilities;
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
 import java.awt.event.ActionEvent;
30
 import java.awt.event.ActionEvent;
33
 import java.awt.event.ActionListener;
31
 import java.awt.event.ActionListener;
34
 
32
 
35
-import javax.swing.BorderFactory;
36
 import javax.swing.DefaultComboBoxModel;
33
 import javax.swing.DefaultComboBoxModel;
37
 import javax.swing.JComboBox;
34
 import javax.swing.JComboBox;
38
 import javax.swing.JPanel;
35
 import javax.swing.JPanel;
39
 import javax.swing.JScrollPane;
36
 import javax.swing.JScrollPane;
40
 import javax.swing.JTextArea;
37
 import javax.swing.JTextArea;
41
 
38
 
39
+import net.miginfocom.swing.MigLayout;
40
+
42
 /**
41
 /**
43
  * Perform panel.
42
  * Perform panel.
44
  */
43
  */
92
     
91
     
93
     /** Initialises teh components. */
92
     /** Initialises teh components. */
94
     private void initComponents() {
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
         final DefaultComboBoxModel model = new DefaultComboBoxModel();
96
         final DefaultComboBoxModel model = new DefaultComboBoxModel();
100
         target = new JComboBox(model);
97
         target = new JComboBox(model);
106
             model.addElement("Server perform (" + server.getName() + ")");
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
         textarea = new JTextArea();
108
         textarea = new JTextArea();
112
         textarea.setColumns(40);
109
         textarea.setColumns(40);
113
         
110
         
114
-        add(new JScrollPane(textarea));
111
+        add(new JScrollPane(textarea), "grow");
115
     }
112
     }
116
     
113
     
117
     /** Adds listeners to the components. */
114
     /** Adds listeners to the components. */

+ 13
- 27
src/com/dmdirc/ui/swing/dialogs/serversetting/ServerSettingsDialog.java 파일 보기

29
 import com.dmdirc.ui.swing.components.StandardDialog;
29
 import com.dmdirc.ui.swing.components.StandardDialog;
30
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel;
30
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel;
31
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel.OptionType;
31
 import com.dmdirc.ui.swing.components.expandingsettings.SettingsPanel.OptionType;
32
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
33
 
32
 
34
 import java.awt.BorderLayout;
33
 import java.awt.BorderLayout;
35
 import java.awt.event.ActionEvent;
34
 import java.awt.event.ActionEvent;
42
 import javax.swing.JPanel;
41
 import javax.swing.JPanel;
43
 import javax.swing.JTabbedPane;
42
 import javax.swing.JTabbedPane;
44
 
43
 
44
+import net.miginfocom.swing.MigLayout;
45
+
45
 /**
46
 /**
46
  * Allows the user to modify server settings and the ignore list.
47
  * Allows the user to modify server settings and the ignore list.
47
  */
48
  */
111
      */
112
      */
112
     public static synchronized ServerSettingsDialog getServerSettingsDialog(final Server server) {
113
     public static synchronized ServerSettingsDialog getServerSettingsDialog(final Server server) {
113
         if (me == null) {
114
         if (me == null) {
114
-            me =    new ServerSettingsDialog(server);
115
+            me = new ServerSettingsDialog(server);
115
         }
116
         }
116
 
117
 
117
         me.pack();
118
         me.pack();
122
     /** Initialises the main UI components. */
123
     /** Initialises the main UI components. */
123
     private void initComponents() {
124
     private void initComponents() {
124
         orderButtons(new JButton(), new JButton());
125
         orderButtons(new JButton(), new JButton());
125
-        initButtonsPanel();
126
 
126
 
127
         tabbedPane = new JTabbedPane();
127
         tabbedPane = new JTabbedPane();
128
 
128
 
129
-        tabbedPane.setBorder(BorderFactory.createEmptyBorder(SMALL_BORDER,
130
-                SMALL_BORDER, 0, SMALL_BORDER));
131
-        
132
         modesPanel = new UserModesPane(server);
129
         modesPanel = new UserModesPane(server);
133
 
130
 
134
         ignoreList =
131
         ignoreList =
154
             tabbedPane.add("Settings", settingsPanel);
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
         tabbedPane.setSelectedIndex(server.getConfigManager().
160
         tabbedPane.setSelectedIndex(server.getConfigManager().
163
                 getOptionInt("dialogstate", "serversettingsdialog", 0));
161
                 getOptionInt("dialogstate", "serversettingsdialog", 0));
231
         settingsPanel.addOption("general.pingtimeout", "Ping timeout",
229
         settingsPanel.addOption("general.pingtimeout", "Ping timeout",
232
                 OptionType.SPINNER);
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
     /** Initialises listeners for this dialog. */
232
     /** Initialises listeners for this dialog. */
251
     private void initListeners() {
233
     private void initListeners() {
252
         getOkButton().addActionListener(this);
234
         getOkButton().addActionListener(this);
265
                 String.valueOf(tabbedPane.getSelectedIndex()));
247
                 String.valueOf(tabbedPane.getSelectedIndex()));
266
     }
248
     }
267
 
249
 
268
-    /** {@inheritDoc} */
250
+    /**
251
+     * {@inheritDoc}
252
+     * 
253
+     * @param e Action event
254
+     */
269
     @Override
255
     @Override
270
     public void actionPerformed(final ActionEvent e) {
256
     public void actionPerformed(final ActionEvent e) {
271
         if (e.getSource() == getOkButton()) {
257
         if (e.getSource() == getOkButton()) {
284
             me = null;
270
             me = null;
285
         }
271
         }
286
     }
272
     }
287
-}
273
+}

+ 11
- 42
src/com/dmdirc/ui/swing/framemanager/buttonbar/ButtonBar.java 파일 보기

35
 import com.dmdirc.ui.swing.UIUtilities;
35
 import com.dmdirc.ui.swing.UIUtilities;
36
 import com.dmdirc.util.MapList;
36
 import com.dmdirc.util.MapList;
37
 
37
 
38
-import java.awt.BorderLayout;
39
 import java.awt.Color;
38
 import java.awt.Color;
40
 import java.awt.Dimension;
39
 import java.awt.Dimension;
41
-import java.awt.GridBagConstraints;
42
-import java.awt.GridBagLayout;
43
 import java.awt.Insets;
40
 import java.awt.Insets;
44
 import java.awt.event.ActionEvent;
41
 import java.awt.event.ActionEvent;
45
 import java.awt.event.ActionListener;
42
 import java.awt.event.ActionListener;
51
 import java.util.List;
48
 import java.util.List;
52
 import java.util.Map;
49
 import java.util.Map;
53
 
50
 
54
-import javax.swing.BorderFactory;
55
 import javax.swing.Icon;
51
 import javax.swing.Icon;
56
 import javax.swing.JComponent;
52
 import javax.swing.JComponent;
57
 import javax.swing.JPanel;
53
 import javax.swing.JPanel;
58
 import javax.swing.JToggleButton;
54
 import javax.swing.JToggleButton;
59
 import javax.swing.SwingConstants;
55
 import javax.swing.SwingConstants;
60
 
56
 
57
+import net.miginfocom.swing.MigLayout;
58
+
61
 /**
59
 /**
62
  * The button bar manager is a grid of buttons that presents a manager similar
60
  * The button bar manager is a grid of buttons that presents a manager similar
63
  * to that used by mIRC.
61
  * to that used by mIRC.
109
         position = FramemanagerPosition.getPosition(
107
         position = FramemanagerPosition.getPosition(
110
                 IdentityManager.getGlobalConfig().getOption("ui", "framemanagerPosition"));
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
     /** {@inheritDoc} */
117
     /** {@inheritDoc} */
117
     public void setParent(final JComponent parent) {
119
     public void setParent(final JComponent parent) {
118
         this.parent = parent;
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
         buttonWidth = position.isHorizontal() ? 150 : (parent.getWidth() 
125
         buttonWidth = position.isHorizontal() ? 150 : (parent.getWidth() 
127
                 - UIUtilities.SMALL_BORDER * 3) / cells;
126
                 - UIUtilities.SMALL_BORDER * 3) / cells;
139
     private void relayout() {
138
     private void relayout() {
140
         panel.removeAll();
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
         for (Map.Entry<FrameContainer, List<FrameContainer>> entry : windows.entrySet()) {
141
         for (Map.Entry<FrameContainer, List<FrameContainer>> entry : windows.entrySet()) {
149
             buttons.get(entry.getKey()).setPreferredSize(new Dimension(buttonWidth, 25));
142
             buttons.get(entry.getKey()).setPreferredSize(new Dimension(buttonWidth, 25));
150
             buttons.get(entry.getKey()).setMinimumSize(new Dimension(buttonWidth, 25));
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
             Collections.sort(entry.getValue(), new FrameContainerComparator());
146
             Collections.sort(entry.getValue(), new FrameContainerComparator());
155
             
147
             
156
             for (FrameContainer child : entry.getValue()) {
148
             for (FrameContainer child : entry.getValue()) {
157
                 buttons.get(child).setPreferredSize(new Dimension(buttonWidth, 25));
149
                 buttons.get(child).setPreferredSize(new Dimension(buttonWidth, 25));
158
                 buttons.get(child).setMinimumSize(new Dimension(buttonWidth, 25));
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
         panel.validate();
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
      * Adds a button to the button array with the details from the specified
158
      * Adds a button to the button array with the details from the specified
190
      * container.
159
      * container.

+ 3
- 3
src/com/dmdirc/ui/swing/framemanager/tree/TreeFrameManager.java 파일 보기

36
 import com.dmdirc.ui.swing.components.TextFrame;
36
 import com.dmdirc.ui.swing.components.TextFrame;
37
 import com.dmdirc.ui.swing.components.TreeScroller;
37
 import com.dmdirc.ui.swing.components.TreeScroller;
38
 
38
 
39
-import java.awt.BorderLayout;
40
 import java.awt.Color;
39
 import java.awt.Color;
41
 import java.awt.Rectangle;
40
 import java.awt.Rectangle;
42
 import java.awt.event.AdjustmentEvent;
41
 import java.awt.event.AdjustmentEvent;
66
 import javax.swing.tree.TreeSelectionModel;
65
 import javax.swing.tree.TreeSelectionModel;
67
 
66
 
68
 import net.miginfocom.layout.PlatformDefaults;
67
 import net.miginfocom.layout.PlatformDefaults;
68
+import net.miginfocom.swing.MigLayout;
69
 
69
 
70
 /**
70
 /**
71
  * Manages open windows in the application in a tree style view.
71
  * Manages open windows in the application in a tree style view.
170
                 scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
170
                 scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
171
                 scrollPane.getHorizontalScrollBar().addAdjustmentListener(TreeFrameManager.this);
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
                 parent.setFocusable(false);
175
                 parent.setFocusable(false);
176
 
176
 
177
                 setColours();
177
                 setColours();

+ 4
- 3
src/com/dmdirc/ui/swing/textpane/TextPane.java 파일 보기

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

Loading…
취소
저장