Browse Source

Tidy up some threading in MainFrame.

Change-Id: Icd048f3eac41cdd31d7d3944fa36eaf78317ee21
Reviewed-on: http://gerrit.dmdirc.com/2474
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.7rc1
Greg Holmes 12 years ago
parent
commit
8f7991aa3c
1 changed files with 19 additions and 27 deletions
  1. 19
    27
      src/com/dmdirc/addons/ui_swing/MainFrame.java

+ 19
- 27
src/com/dmdirc/addons/ui_swing/MainFrame.java View File

@@ -55,7 +55,6 @@ import java.awt.event.WindowEvent;
55 55
 import java.awt.event.WindowFocusListener;
56 56
 import java.awt.event.WindowListener;
57 57
 import java.lang.reflect.InvocationTargetException;
58
-import java.util.concurrent.Callable;
59 58
 
60 59
 import javax.swing.ImageIcon;
61 60
 import javax.swing.JFrame;
@@ -188,19 +187,12 @@ public final class MainFrame extends JFrame implements WindowListener,
188 187
      * @return Frame manager size.
189 188
      */
190 189
     public int getFrameManagerSize() {
191
-        return UIUtilities.invokeAndWait(new Callable<Integer>() {
192
-
193
-            /** {@inheritDoc} */
194
-            @Override
195
-            public Integer call() {
196
-                if (position == FramemanagerPosition.LEFT || position
197
-                        == FramemanagerPosition.RIGHT) {
198
-                    return frameManagerPanel.getWidth();
199
-                } else {
200
-                    return frameManagerPanel.getHeight();
201
-                }
202
-            }
203
-        });
190
+        if (position == FramemanagerPosition.LEFT
191
+                || position == FramemanagerPosition.RIGHT) {
192
+            return frameManagerPanel.getWidth();
193
+        } else {
194
+            return frameManagerPanel.getHeight();
195
+        }
204 196
     }
205 197
 
206 198
     /**
@@ -209,14 +201,7 @@ public final class MainFrame extends JFrame implements WindowListener,
209 201
      * @return The active window
210 202
      */
211 203
     public TextFrame getActiveFrame() {
212
-        return UIUtilities.invokeAndWait(new Callable<TextFrame>() {
213
-
214
-            /** {@inheritDoc} */
215
-            @Override
216
-            public TextFrame call() {
217
-                return activeFrame;
218
-            }
219
-        });
204
+        return activeFrame;
220 205
     }
221 206
 
222 207
     /** {@inheritDoc} */
@@ -228,11 +213,18 @@ public final class MainFrame extends JFrame implements WindowListener,
228 213
     /** {@inheritDoc}. */
229 214
     @Override
230 215
     public void setTitle(final String title) {
231
-        if (title == null || activeFrame == null) {
232
-            super.setTitle(getTitlePrefix());
233
-        } else {
234
-            super.setTitle(getTitlePrefix() + " - " + title);
235
-        }
216
+        UIUtilities.invokeLater(new Runnable() {
217
+
218
+            /** {@inheritDoc}. */
219
+            @Override
220
+            public void run() {
221
+                if (title == null || activeFrame == null) {
222
+                    MainFrame.super.setTitle(getTitlePrefix());
223
+                } else {
224
+                    MainFrame.super.setTitle(getTitlePrefix() + " - " + title);
225
+                }
226
+            }
227
+        });
236 228
     }
237 229
 
238 230
     /**

Loading…
Cancel
Save