src/Pure/System/build_dialog.scala
changeset 50379 a8b0d3729a69
parent 50378 72367327bab2
child 50381 d9711842f1f9
equal deleted inserted replaced
50378:72367327bab2 50379:a8b0d3729a69
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 
     9 
    10 import java.awt.{GraphicsEnvironment, Point, Font}
    10 import java.awt.{GraphicsEnvironment, Point, Font}
       
    11 import java.awt.event.{KeyEvent, ActionEvent}
       
    12 import javax.swing.{JButton, AbstractAction, JComponent, KeyStroke}
       
    13 
    11 import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
    14 import scala.swing.{ScrollPane, Button, CheckBox, FlowPanel,
    12   BorderPanel, MainFrame, TextArea, SwingApplication}
    15   BorderPanel, MainFrame, TextArea, SwingApplication}
    13 import scala.swing.event.ButtonClicked
    16 import scala.swing.event.ButtonClicked
    14 
    17 
    15 
    18 
    73 
    76 
    74     var button_action: () => Unit = (() => is_stopped = true)
    77     var button_action: () => Unit = (() => is_stopped = true)
    75     val button = new Button("Cancel") {
    78     val button = new Button("Cancel") {
    76       reactions += { case ButtonClicked(_) => button_action() }
    79       reactions += { case ButtonClicked(_) => button_action() }
    77     }
    80     }
       
    81 
       
    82     button.peer.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
       
    83       KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ENTER")
       
    84     button.peer.getActionMap.put("ENTER",
       
    85       new AbstractAction {
       
    86         override def actionPerformed(e: ActionEvent) { button.peer.doClick }
       
    87       })
       
    88 
    78     def button_exit(rc: Int)
    89     def button_exit(rc: Int)
    79     {
    90     {
    80       button.text = if (rc == 0) "OK" else "Exit"
    91       button.text = if (rc == 0) "OK" else "Exit"
    81       button_action = (() => sys.exit(rc))
    92       button_action = (() => sys.exit(rc))
    82     }
    93     }