From f73e819a415ecd290c5464206a4ef2a4080075f5 Mon Sep 17 00:00:00 2001 From: Ingo Maier Date: Fri, 21 Aug 2009 14:31:10 +0000 Subject: Fixed #2169 --- src/swing/scala/swing/Swing.scala | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/swing') diff --git a/src/swing/scala/swing/Swing.scala b/src/swing/scala/swing/Swing.scala index ce14a0f8fd..430e89a935 100644 --- a/src/swing/scala/swing/Swing.scala +++ b/src/swing/scala/swing/Swing.scala @@ -32,16 +32,13 @@ object Swing { implicit def pair2Point(p: (Int, Int)): Point = new Point(p._1, p._2) implicit def pair2Point(p: (Int, Int, Int, Int)): Rectangle = new Rectangle(p._1, p._2, p._3, p._4) - /** - * Allows one to use blocks as runnables. - */ - implicit def block2Runnable(block: =>Unit): Runnable = new Runnable { - override def run = block + @inline final def Runnable(@inline block: =>Unit) = new Runnable { + def run = block } - def ChangeListener(f: ChangeEvent => Unit) = new ChangeListener { + final def ChangeListener(f: ChangeEvent => Unit) = new ChangeListener { def stateChanged(e: ChangeEvent) { f(e) } } - def ActionListener(f: ActionEvent => Unit) = new ActionListener { + final def ActionListener(f: ActionEvent => Unit) = new ActionListener { def actionPerformed(e: ActionEvent) { f(e) } } @@ -137,11 +134,11 @@ object Swing { * Schedule the given code to be executed on the Swing event dispatching * thread (EDT). Returns immediately. */ - def onEDT(op: =>Unit) = SwingUtilities invokeLater op + @inline final def onEDT(op: =>Unit) = SwingUtilities invokeLater Runnable(op) /** * Schedule the given code to be executed on the Swing event dispatching * thread (EDT). Blocks until after the code has been run. */ - def onEDTWait(op: =>Unit) = SwingUtilities invokeAndWait op + @inline final def onEDTWait(op: =>Unit) = SwingUtilities invokeAndWait Runnable(op) } -- cgit v1.2.3