diff options
author | Ingo Maier <ingo.maier@epfl.ch> | 2009-08-21 14:31:10 +0000 |
---|---|---|
committer | Ingo Maier <ingo.maier@epfl.ch> | 2009-08-21 14:31:10 +0000 |
commit | f73e819a415ecd290c5464206a4ef2a4080075f5 (patch) | |
tree | ffb5bf2f0452c9fb9fe16bfec67c844e66b8781d /src/swing | |
parent | 70d9557ab467930bc84982e13e741e88471c9e06 (diff) | |
download | scala-f73e819a415ecd290c5464206a4ef2a4080075f5.tar.gz scala-f73e819a415ecd290c5464206a4ef2a4080075f5.tar.bz2 scala-f73e819a415ecd290c5464206a4ef2a4080075f5.zip |
Fixed #2169
Diffstat (limited to 'src/swing')
-rw-r--r-- | src/swing/scala/swing/Swing.scala | 15 |
1 files changed, 6 insertions, 9 deletions
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) } |