Browse Source

Fix a couple of bugs in the popup windows.

pull/330/head
Greg Holmes 9 years ago
parent
commit
abdfd78f1e

+ 3
- 7
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/DesktopWindowFrame.java View File

@@ -23,11 +23,10 @@
23 23
 package com.dmdirc.addons.ui_swing.components.frames;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
26
+import com.dmdirc.addons.ui_swing.components.IconManager;
26 27
 import com.dmdirc.events.FrameIconChangedEvent;
27 28
 import com.dmdirc.events.FrameTitleChangedEvent;
28
-import com.dmdirc.addons.ui_swing.components.IconManager;
29
-
30
-import java.awt.Point;
29
+import com.dmdirc.ui.CoreUIUtils;
31 30
 
32 31
 import javax.swing.JFrame;
33 32
 
@@ -46,8 +45,6 @@ public class DesktopWindowFrame extends JFrame {
46 45
     /** TextFrame associated with this popout window. */
47 46
     private final TextFrame windowWindow;
48 47
     private final IconManager iconManager;
49
-    /** Initial location for popped out window. */
50
-    private final Point initialLocation;
51 48
 
52 49
     /**
53 50
      * Creates a new instance of DesktopWindowFrame.
@@ -57,7 +54,6 @@ public class DesktopWindowFrame extends JFrame {
57 54
     public DesktopWindowFrame(final TextFrame windowWindow, final IconManager iconManager) {
58 55
         this.windowWindow = windowWindow;
59 56
         this.iconManager = iconManager;
60
-        initialLocation = windowWindow.getLocationOnScreen();
61 57
 
62 58
         setLayout(new MigLayout("fill, ins rel"));
63 59
         add(windowWindow, "grow");
@@ -71,8 +67,8 @@ public class DesktopWindowFrame extends JFrame {
71 67
      */
72 68
     public void display() {
73 69
         pack();
70
+        CoreUIUtils.centreWindow(this);
74 71
         setVisible(true);
75
-        setLocation(initialLocation);
76 72
     }
77 73
 
78 74
     @Handler(invocation = EdtHandlerInvocation.class, delivery = Invoke.Asynchronously)

+ 2
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java View File

@@ -182,9 +182,9 @@ public abstract class TextFrame extends JPanel implements Window, TextPaneListen
182 182
             popoutFrame.dispose();
183 183
             eventBus.unsubscribe(popoutFrame);
184 184
             popoutFrame = null;
185
-            // TODO: This is a horrible hack really.
186
-            swingEventBus.publishAsync(new SwingActiveWindowChangeRequestEvent(Optional.of(this)));
187 185
         }
186
+        // TODO: This is a horrible hack really.
187
+        swingEventBus.publishAsync(new SwingActiveWindowChangeRequestEvent(Optional.of(this)));
188 188
     }
189 189
 
190 190
     /**

Loading…
Cancel
Save