center main window;
authorwenzelm
Wed, 05 Dec 2012 20:24:49 +0100
changeset 50377 fe4bc5b2abb4
parent 50376 82cbe4051d98
child 50378 72367327bab2
center main window;
src/Pure/System/build_dialog.scala
--- a/src/Pure/System/build_dialog.scala	Wed Dec 05 19:46:47 2012 +0100
+++ b/src/Pure/System/build_dialog.scala	Wed Dec 05 20:24:49 2012 +0100
@@ -7,6 +7,7 @@
 package isabelle
 
 
+import java.awt.{GraphicsEnvironment, Point}
 import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
   BorderPanel, MainFrame, TextArea, SwingApplication}
 import scala.swing.event.ButtonClicked
@@ -23,8 +24,10 @@
         case
           Properties.Value.Boolean(system_mode) ::
           session :: include_dirs =>
+            val center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint()
             val top = build_dialog(system_mode, include_dirs.map(Path.explode), session)
             top.pack()
+            top.location = new Point(center.x - top.size.width / 2, center.y - top.size.height / 2)
             top.visible = true
         case _ => error("Bad arguments:\n" + cat_lines(args))
       }