src/Pure/GUI/gui.scala
changeset 57612 990ffb84489b
parent 57044 042d6e58cb40
child 57639 ba170c8ea578
equal deleted inserted replaced
57611:b6256ea3b7c5 57612:990ffb84489b
    87   }
    87   }
    88 
    88 
    89   private def simple_dialog(kind: Int, default_title: String,
    89   private def simple_dialog(kind: Int, default_title: String,
    90     parent: Component, title: String, message: Seq[Any])
    90     parent: Component, title: String, message: Seq[Any])
    91   {
    91   {
    92     Swing_Thread.now {
    92     GUI_Thread.now {
    93       val java_message = message map { case x: scala.swing.Component => x.peer case x => x }
    93       val java_message = message map { case x: scala.swing.Component => x.peer case x => x }
    94       JOptionPane.showMessageDialog(parent,
    94       JOptionPane.showMessageDialog(parent,
    95         java_message.toArray.asInstanceOf[Array[AnyRef]],
    95         java_message.toArray.asInstanceOf[Array[AnyRef]],
    96         if (title == null) default_title else title, kind)
    96         if (title == null) default_title else title, kind)
    97     }
    97     }
   105 
   105 
   106   def error_dialog(parent: Component, title: String, message: Any*) =
   106   def error_dialog(parent: Component, title: String, message: Any*) =
   107     simple_dialog(JOptionPane.ERROR_MESSAGE, "Error", parent, title, message)
   107     simple_dialog(JOptionPane.ERROR_MESSAGE, "Error", parent, title, message)
   108 
   108 
   109   def confirm_dialog(parent: Component, title: String, option_type: Int, message: Any*): Int =
   109   def confirm_dialog(parent: Component, title: String, option_type: Int, message: Any*): Int =
   110     Swing_Thread.now {
   110     GUI_Thread.now {
   111       val java_message = message map { case x: scala.swing.Component => x.peer case x => x }
   111       val java_message = message map { case x: scala.swing.Component => x.peer case x => x }
   112       JOptionPane.showConfirmDialog(parent,
   112       JOptionPane.showConfirmDialog(parent,
   113         java_message.toArray.asInstanceOf[Array[AnyRef]], title,
   113         java_message.toArray.asInstanceOf[Array[AnyRef]], title,
   114           option_type, JOptionPane.QUESTION_MESSAGE)
   114           option_type, JOptionPane.QUESTION_MESSAGE)
   115     }
   115     }