diff --git a/src/swing/scala/swing/Frame.scala b/src/swing/scala/swing/Frame.scala index 6e7b24915..3e37f28c0 100644 --- a/src/swing/scala/swing/Frame.scala +++ b/src/swing/scala/swing/Frame.scala @@ -1,5 +1,6 @@ package scala.swing +import java.awt.{Image, Point} import javax.swing._ import event._ @@ -34,6 +35,10 @@ class Frame extends UIElement with RootPanel with Publisher { def menuBar_=(m: MenuBar) = peer.setJMenuBar(m.peer) def setLocationRelativeTo(c: UIElement) { peer.setLocationRelativeTo(c.peer) } + def location_=(p: Point) { peer.setLocation(p) } + + def iconImage: Image = peer.getIconImage + def iconImage_=(i: Image) { peer.setIconImage(i) } peer.addWindowListener(new java.awt.event.WindowListener { def windowActivated(e: java.awt.event.WindowEvent) { publish(WindowActivated(Frame.this)) } diff --git a/src/swing/scala/swing/Swing.scala b/src/swing/scala/swing/Swing.scala index a24fd39d4..baeae09e2 100644 --- a/src/swing/scala/swing/Swing.scala +++ b/src/swing/scala/swing/Swing.scala @@ -2,7 +2,7 @@ package scala.swing import java.awt.event._ import javax.swing.event._ -import java.awt.{Color, Dimension} +import java.awt.{Color, Dimension, Point} import javax.swing.border._ import javax.swing.{JComponent, Icon, BorderFactory} @@ -16,6 +16,12 @@ object Swing { protected[swing] def toNoIcon(i: Icon): Icon = if(i == null) EmptyIcon else i protected[swing] def toNullIcon(i: Icon): Icon = if(i == EmptyIcon) null else i + implicit def pair2Dimension(p: (Int, Int)): Dimension = new Dimension(p._1, p._2) + implicit def pair2Point(p: (Int, Int)): Point = new Point(p._1, p._2) + + /** + * Allows one to use blocks as runnables. + */ implicit def block2Runnable(block: =>Unit): Runnable = new Runnable { override def run = block }