src/Pure/library.scala
changeset 34216 ada8eb23a08e
parent 34198 ff5486262cd6
child 34314 f799f3749596
equal deleted inserted replaced
34215:f0322b595146 34216:ada8eb23a08e
     5 */
     5 */
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 import java.lang.System
     9 import java.lang.System
       
    10 import java.awt.Component
       
    11 import javax.swing.JOptionPane
    10 
    12 
    11 
    13 
    12 object Library
    14 object Library
    13 {
    15 {
    14   /* reverse CharSequence */
    16   /* reverse CharSequence */
    34       buf.toString
    36       buf.toString
    35     }
    37     }
    36   }
    38   }
    37 
    39 
    38 
    40 
       
    41   /* simple dialogs */
       
    42 
       
    43   private def simple_dialog(kind: Int, default_title: String)
       
    44     (parent: Component, title: String, message: Any*)
       
    45   {
       
    46     JOptionPane.showMessageDialog(parent,
       
    47       message.toArray.asInstanceOf[Array[AnyRef]],
       
    48       if (title == null) default_title else title, kind)
       
    49   }
       
    50 
       
    51   def dialog = simple_dialog(JOptionPane.PLAIN_MESSAGE, null) _
       
    52   def warning_dialog = simple_dialog(JOptionPane.WARNING_MESSAGE, "Warning") _
       
    53   def error_dialog = simple_dialog(JOptionPane.ERROR_MESSAGE, "Error") _
       
    54 
       
    55 
    39   /* timing */
    56   /* timing */
    40 
    57 
    41   def timeit[A](e: => A) =
    58   def timeit[A](e: => A) =
    42   {
    59   {
    43     val start = System.currentTimeMillis()
    60     val start = System.currentTimeMillis()