diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/swing/scala/swing/ListView.scala | 3 | ||||
-rw-r--r-- | src/swing/scala/swing/Swing.scala | 8 | ||||
-rw-r--r-- | src/swing/scala/swing/test/CelsiusConverter.scala | 8 | ||||
-rw-r--r-- | src/swing/scala/swing/test/CelsiusConverter2.scala | 7 | ||||
-rw-r--r-- | src/swing/scala/swing/test/UIDemo.scala | 6 | ||||
-rw-r--r-- | src/swing/swing.version.properties | 2 |
6 files changed, 19 insertions, 15 deletions
diff --git a/src/swing/scala/swing/ListView.scala b/src/swing/scala/swing/ListView.scala index 1b1fbb76e8..4773a5e65c 100644 --- a/src/swing/scala/swing/ListView.scala +++ b/src/swing/scala/swing/ListView.scala @@ -178,6 +178,9 @@ class ListView[A] extends Component { def fixedCellHeight = peer.getFixedCellHeight def fixedCellHeight_=(x: Int) = peer.setFixedCellHeight(x) + def prototypeCellValue: A = peer.getPrototypeCellValue.asInstanceOf[A] + def prototypeCellValue_=(a: A) { peer.setPrototypeCellValue(a) } + def selectionForeground: Color = peer.getSelectionForeground def selectionForeground_=(c: Color) = peer.setSelectionForeground(c) def selectionBackground: Color = peer.getSelectionBackground diff --git a/src/swing/scala/swing/Swing.scala b/src/swing/scala/swing/Swing.scala index 80d22d7a10..445c9c85f8 100644 --- a/src/swing/scala/swing/Swing.scala +++ b/src/swing/scala/swing/Swing.scala @@ -12,8 +12,8 @@ object Swing { protected[swing] def ifNull[A](o: Object, a: A): A = if(o eq null) a else o.asInstanceOf[A] protected[swing] def toOption[A](o: Object): Option[A] = if(o eq null) None else Some(o.asInstanceOf[A]) protected[swing] def toNull[A>:Null<:AnyRef](a: Option[A]): A = if(a == None) null else a.get - protected[swing] def toNoIcon(i: Icon): Icon = if(i == null) Icon.Empty else i - protected[swing] def toNullIcon(i: Icon): Icon = if(i == Icon.Empty) null else i + protected[swing] def toNoIcon(i: Icon): Icon = if(i == null) swing.Icon.Empty else i + protected[swing] def toNullIcon(i: Icon): Icon = if(i == swing.Icon.Empty) null else i implicit def block2Runnable(block: =>Unit): Runnable = new Runnable { override def run = block @@ -46,4 +46,8 @@ object Swing { def VStrut(height: Int) = new Component { override lazy val peer = javax.swing.Box.createVerticalStrut(height).asInstanceOf[JComponent] } + + def Icon(image: java.awt.Image) = new javax.swing.ImageIcon(image) + def Icon(filename: String) = new javax.swing.ImageIcon(filename) + def Icon(url: java.net.URL) = new javax.swing.ImageIcon(url) } diff --git a/src/swing/scala/swing/test/CelsiusConverter.scala b/src/swing/scala/swing/test/CelsiusConverter.scala index 985e562d6d..baa644b30a 100644 --- a/src/swing/scala/swing/test/CelsiusConverter.scala +++ b/src/swing/scala/swing/test/CelsiusConverter.scala @@ -9,16 +9,16 @@ object CelsiusConverter extends SimpleGUIApplication { def top = new MainFrame { title = "Convert Celsius to Fahrenheit" defaultButton = Some(convertButton) - object tempCelsius extends TextField - object celsiusLabel extends Label { + val tempCelsius = new TextField + val celsiusLabel = new Label { text = "Celsius" border = Border.Empty(5, 5, 5, 5) } - object convertButton extends Button { + val convertButton = new Button { text = "Convert"//new javax.swing.ImageIcon("c:\\workspace\\gui\\images\\convert.gif") //border = Border.Empty(5, 5, 5, 5) } - object fahrenheitLabel extends Label { + val fahrenheitLabel = new Label { text = "Fahrenheit " border = Border.Empty(5, 5, 5, 5) listenTo(convertButton, tempCelsius) diff --git a/src/swing/scala/swing/test/CelsiusConverter2.scala b/src/swing/scala/swing/test/CelsiusConverter2.scala index 728c63c8fa..200fd67d4b 100644 --- a/src/swing/scala/swing/test/CelsiusConverter2.scala +++ b/src/swing/scala/swing/test/CelsiusConverter2.scala @@ -5,9 +5,10 @@ import event._ object CelsiusConverter2 extends SimpleGUIApplication { val ui = new FlowPanel { - object Celsius extends TextField { columns = 5 } - object Fahrenheit extends TextField { columns = 5 } - contents.append(Celsius, new Label(" Celsius = "), Fahrenheit, new Label(" Fahrenheit")) + val Celsius = new TextField { columns = 5 } + val Fahrenheit = new TextField { columns = 5 } + contents.append(Celsius, new Label(" Celsius = "), + Fahrenheit, new Label(" Fahrenheit")) border = Border.Empty(15, 10, 10, 10) listenTo(Fahrenheit, Celsius) diff --git a/src/swing/scala/swing/test/UIDemo.scala b/src/swing/scala/swing/test/UIDemo.scala index 8dbec4379b..4faaebbb93 100644 --- a/src/swing/scala/swing/test/UIDemo.scala +++ b/src/swing/scala/swing/test/UIDemo.scala @@ -5,9 +5,6 @@ import event._ import Swing._ object UIDemo extends SimpleGUIApplication { - //new java.awt.Font("Bitstream Vera Sans", java.awt.Font.PLAIN, 16). - //javax.swing.UIManager.getLookAndFeelDefaults().put("defaultFont", new java.awt.Font("Bitstream Vera Sans", java.awt.Font.PLAIN, 16)) - def top = new MainFrame { title = "UIElement Test" @@ -66,6 +63,7 @@ object UIDemo extends SimpleGUIApplication { case ButtonClicked(`snapTicks`) => slider.snapToTicks = snapTicks.selected case ButtonClicked(`live`) => + println("") reactLive = live.selected } } @@ -131,7 +129,5 @@ object UIDemo extends SimpleGUIApplication { } } } - //val keys = javax.swing.UIManager.getDefaults().keys - //while(keys.hasMoreElements) println(keys.nextElement) } diff --git a/src/swing/swing.version.properties b/src/swing/swing.version.properties index 4b7e7dc0cb..30ac6bb89e 100644 --- a/src/swing/swing.version.properties +++ b/src/swing/swing.version.properties @@ -1,2 +1,2 @@ version.major=0 -version.minor=2
\ No newline at end of file +version.minor=4
\ No newline at end of file |