src/Pure/System/gui_setup.scala
author wenzelm
Sat, 17 Apr 2010 21:40:29 +0200
changeset 36195 9c098598db2a
parent 36193 067a01827fca
child 36197 2e92aca73cab
permissions -rw-r--r--
system properties determine the JVM platform, not the Isabelle one;

/*  Title:      Pure/System/gui_setup.scala
    Author:     Makarius

GUI for basic system setup.
*/

package isabelle

import javax.swing.UIManager

import scala.swing._
import scala.swing.event._


object GUI_Setup extends GUIApplication
{
  def main(args: Array[String]) =
  {
    Swing_Thread.later {
      UIManager.setLookAndFeel(Platform.look_and_feel)
      top.pack()
      top.visible = true
    }
  }

  def top = new MainFrame {
    title = "Isabelle setup"

    // components
    val text = new TextArea {
      editable = false
      columns = 80
      rows = 20
      xLayoutAlignment = 0.5
    }
    val ok = new Button {
      text = "OK"
      xLayoutAlignment = 0.5
    }
    contents = new BoxPanel(Orientation.Vertical) {
      contents += text
      contents += ok
    }

    // values
    text.append("JVM platform: " + Platform.jvm_platform() + "\n")
    if (Platform.is_windows)
      text.append("Cygwin root: " + Cygwin.check_root() + "\n")
    try {
      val isabelle_system = new Isabelle_System
      text.append("Isabelle home: " + isabelle_system.getenv("ISABELLE_HOME") + "\n")
      text.append("Isabelle java: " + isabelle_system.this_java())
    } catch {
      case e: RuntimeException => text.append(e.getMessage + "\n")
    }

    // reactions
    listenTo(ok)
    reactions += {
      case ButtonClicked(`ok`) => System.exit(0)
    }
  }
}