Browse Source

code tidying, more *_BORDER removal

git-svn-id: http://svn.dmdirc.com/trunk@3788 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 years ago
parent
commit
5b5cad149d

+ 7
- 5
src/com/dmdirc/ui/swing/components/InputTextFrame.java View File

@@ -38,7 +38,6 @@ import com.dmdirc.ui.swing.actions.CopyAction;
38 38
 import com.dmdirc.ui.swing.actions.CutAction;
39 39
 import com.dmdirc.ui.swing.actions.InputTextFramePasteAction;
40 40
 import com.dmdirc.ui.swing.dialogs.paste.PasteDialog;
41
-import static com.dmdirc.ui.swing.UIUtilities.SMALL_BORDER;
42 41
 import com.dmdirc.ui.swing.actions.CommandAction;
43 42
 
44 43
 import java.awt.AWTException;
@@ -49,7 +48,6 @@ import java.awt.Robot;
49 48
 import java.awt.Toolkit;
50 49
 import java.awt.datatransfer.DataFlavor;
51 50
 import java.awt.datatransfer.UnsupportedFlavorException;
52
-import java.awt.event.ActionListener;
53 51
 import java.awt.event.KeyEvent;
54 52
 import java.awt.event.KeyListener;
55 53
 import java.awt.event.MouseEvent;
@@ -57,7 +55,6 @@ import java.awt.event.MouseListener;
57 55
 import java.io.IOException;
58 56
 import java.io.Serializable;
59 57
 
60
-import javax.swing.BorderFactory;
61 58
 import javax.swing.JComponent;
62 59
 import javax.swing.JLabel;
63 60
 import javax.swing.JMenu;
@@ -68,6 +65,9 @@ import javax.swing.JSeparator;
68 65
 import javax.swing.KeyStroke;
69 66
 import javax.swing.event.InternalFrameEvent;
70 67
 import javax.swing.event.InternalFrameListener;
68
+import net.miginfocom.layout.PlatformDefaults;
69
+
70
+import net.miginfocom.swing.MigLayout;
71 71
 
72 72
 /**
73 73
  * Frame with an input field.
@@ -164,7 +164,9 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
164 164
         awayLabel.setText("(away)");
165 165
         awayLabel.setVisible(false);
166 166
 
167
-        inputPanel = new JPanel(new BorderLayout(SMALL_BORDER, SMALL_BORDER));
167
+        inputPanel = new JPanel(new BorderLayout(
168
+                (int) PlatformDefaults.getUnitValueX("related").getValue(), 
169
+                (int) PlatformDefaults.getUnitValueX("related").getValue()));
168 170
         inputPanel.add(awayLabel, BorderLayout.LINE_START);
169 171
         inputPanel.add(inputField, BorderLayout.CENTER);
170 172
 
@@ -418,7 +420,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
418 420
                 initPopupMenu();
419 421
                 inputFieldPopup.show(this, (int) point.getX(),
420 422
                         (int) point.getY() + getTextPane().getHeight() +
421
-                        SMALL_BORDER);
423
+                        (int) PlatformDefaults.getUnitValueX("related").getValue());
422 424
             }
423 425
         }
424 426
         super.processMouseEvent(e);

+ 15
- 13
src/com/dmdirc/ui/swing/components/SwingInputField.java View File

@@ -52,14 +52,16 @@ public class SwingInputField extends JComponent implements InputField,
52 52
     /** Colour picker. */
53 53
     private ColourPickerDialog colourPicker;
54 54
     /** Input field text field. */
55
-    private JTextField textField;
55
+    private final JTextField textField;
56 56
     /** Line wrap indicator. */
57
-    private JLabel wrapIndicator;
57
+    private final JLabel wrapIndicator;
58 58
 
59 59
     /**
60 60
      * Instantiates a new swing input field.
61 61
      */
62 62
     public SwingInputField() {
63
+        super();
64
+        
63 65
         textField = new JTextField();
64 66
         textField.setFocusTraversalKeysEnabled(false);
65 67
         wrapIndicator =
@@ -89,7 +91,7 @@ public class SwingInputField extends JComponent implements InputField,
89 91
 
90 92
     /** {@inheritDoc} */
91 93
     @Override
92
-    public void showColourPicker(boolean irc, boolean hex) {
94
+    public void showColourPicker(final boolean irc, final boolean hex) {
93 95
         if (IdentityManager.getGlobalConfig().getOptionBool("general",
94 96
                 "showcolourdialog", false)) {
95 97
             colourPicker = new ColourPickerDialog(irc, hex);
@@ -135,25 +137,25 @@ public class SwingInputField extends JComponent implements InputField,
135 137
 
136 138
     /** {@inheritDoc} */
137 139
     @Override
138
-    public void addActionListener(ActionListener listener) {
140
+    public void addActionListener(final ActionListener listener) {
139 141
         textField.addActionListener(listener);
140 142
     }
141 143
 
142 144
     /** {@inheritDoc} */
143 145
     @Override
144
-    public void addKeyListener(KeyListener listener) {
146
+    public void addKeyListener(final KeyListener listener) {
145 147
         textField.addKeyListener(listener);
146 148
     }
147 149
 
148 150
     /** {@inheritDoc} */
149 151
     @Override
150
-    public void removeActionListener(ActionListener listener) {
152
+    public void removeActionListener(final ActionListener listener) {
151 153
         textField.removeActionListener(listener);
152 154
     }
153 155
 
154 156
     /** {@inheritDoc} */
155 157
     @Override
156
-    public void removeKeyListener(KeyListener listener) {
158
+    public void removeKeyListener(final KeyListener listener) {
157 159
         textField.removeKeyListener(listener);
158 160
     }
159 161
 
@@ -183,7 +185,7 @@ public class SwingInputField extends JComponent implements InputField,
183 185
 
184 186
     /** {@inheritDoc} */
185 187
     @Override
186
-    public void setText(String text) {
188
+    public void setText(final String text) {
187 189
         textField.setText(text);
188 190
     }
189 191
 
@@ -195,7 +197,7 @@ public class SwingInputField extends JComponent implements InputField,
195 197
 
196 198
     /** {@inheritDoc} */
197 199
     @Override
198
-    public void setCaretPosition(int position) {
200
+    public void setCaretPosition(final int position) {
199 201
         textField.setCaretPosition(position);
200 202
     }
201 203
 
@@ -204,7 +206,7 @@ public class SwingInputField extends JComponent implements InputField,
204 206
      * 
205 207
      * @param clipboard Text to replace selection with
206 208
      */
207
-    public void replaceSelection(String clipboard) {
209
+    public void replaceSelection(final String clipboard) {
208 210
         textField.replaceSelection(clipboard);
209 211
     }
210 212
 
@@ -213,7 +215,7 @@ public class SwingInputField extends JComponent implements InputField,
213 215
      * 
214 216
      * @param optionColour Colour for the caret
215 217
      */
216
-    public void setCaretColor(Color optionColour) {
218
+    public void setCaretColor(final Color optionColour) {
217 219
         textField.setCaretColor(optionColour);
218 220
     }
219 221
 
@@ -223,7 +225,7 @@ public class SwingInputField extends JComponent implements InputField,
223 225
      * @param optionColour Colour for the caret
224 226
      */
225 227
     @Override
226
-    public void setForeground(Color optionColour) {
228
+    public void setForeground(final Color optionColour) {
227 229
         textField.setForeground(optionColour);
228 230
     }
229 231
 
@@ -233,7 +235,7 @@ public class SwingInputField extends JComponent implements InputField,
233 235
      * @param optionColour Colour for the caret
234 236
      */
235 237
     @Override
236
-    public void setBackground(Color optionColour) {
238
+    public void setBackground(final Color optionColour) {
237 239
         textField.setBackground(optionColour);
238 240
     }
239 241
 

Loading…
Cancel
Save