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