src/Pure/System/gui_setup.scala
author wenzelm
Tue Jun 30 00:50:42 2009 +0200 (2009-06-30)
changeset 31860 e49011bb85da
parent 31844 3d5e51dbafe9
child 31862 53acb8ec6c51
permissions -rw-r--r--
more display;
wenzelm@31827
     1
/*  Title:      Pure/System/gui_setup.scala
wenzelm@31827
     2
    Author:     Makarius
wenzelm@31827
     3
wenzelm@31827
     4
GUI for basic system setup.
wenzelm@31827
     5
*/
wenzelm@31827
     6
wenzelm@31827
     7
package isabelle
wenzelm@31827
     8
wenzelm@31828
     9
import javax.swing.UIManager
wenzelm@31828
    10
wenzelm@31827
    11
import scala.swing._
wenzelm@31827
    12
import scala.swing.event._
wenzelm@31827
    13
wenzelm@31827
    14
wenzelm@31828
    15
object GUI_Setup extends GUIApplication
wenzelm@31827
    16
{
wenzelm@31828
    17
  def main(args: Array[String]) =
wenzelm@31828
    18
  {
wenzelm@31828
    19
    Swing.later {
wenzelm@31828
    20
      UIManager.setLookAndFeel(Platform.look_and_feel)
wenzelm@31828
    21
      top.pack()
wenzelm@31828
    22
      top.visible = true
wenzelm@31828
    23
    }
wenzelm@31828
    24
  }
wenzelm@31828
    25
wenzelm@31827
    26
  def top = new MainFrame {
wenzelm@31827
    27
    title = "Isabelle setup"
wenzelm@31827
    28
wenzelm@31843
    29
    // components
wenzelm@31843
    30
    val text = new TextArea {
wenzelm@31843
    31
      editable = false
wenzelm@31860
    32
      columns = 80
wenzelm@31860
    33
      rows = 20
wenzelm@31843
    34
      xLayoutAlignment = 0.5
wenzelm@31843
    35
    }
wenzelm@31843
    36
    val ok = new Button {
wenzelm@31843
    37
      text = "OK"
wenzelm@31843
    38
      xLayoutAlignment = 0.5
wenzelm@31843
    39
    }
wenzelm@31827
    40
    contents = new BoxPanel(Orientation.Vertical) {
wenzelm@31843
    41
      contents += text
wenzelm@31827
    42
      contents += ok
wenzelm@31827
    43
    }
wenzelm@31827
    44
wenzelm@31843
    45
    // values
wenzelm@31844
    46
    if (Platform.is_windows) {
wenzelm@31844
    47
      text.append("Cygwin root: " + Cygwin.config()._1 + "\n")
wenzelm@31844
    48
    }
wenzelm@31843
    49
    Platform.defaults match {
wenzelm@31843
    50
      case None =>
wenzelm@31844
    51
      case Some((name, None)) => text.append("Platform: " + name + "\n")
wenzelm@31843
    52
      case Some((name1, Some(name2))) =>
wenzelm@31844
    53
        text.append("Main platform: " + name1 + "\n")
wenzelm@31844
    54
        text.append("Alternative platform: " + name2 + "\n")
wenzelm@31843
    55
    }
wenzelm@31860
    56
    text.append("Isabelle home: " + java.lang.System.getProperty("isabelle.home"))
wenzelm@31843
    57
wenzelm@31843
    58
    // reactions
wenzelm@31827
    59
    listenTo(ok)
wenzelm@31827
    60
    reactions += {
wenzelm@31827
    61
      case ButtonClicked(`ok`) => System.exit(0)
wenzelm@31827
    62
    }
wenzelm@31827
    63
  }
wenzelm@31827
    64
}
wenzelm@31827
    65