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

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

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

Loading…
Cancel
Save