Changeset 6915 for lang/scala/sandbox
- Timestamp:
- 02/19/08 15:24:19 (9 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/scala/sandbox/src/jp/gr/java_conf/mizu/gui/GUIBuilder.scala
r6914 r6915 4 4 import java.awt.Container 5 5 import java.awt.Dimension 6 import java.awt.LayoutManager 6 7 import java.awt.event.ActionEvent 7 8 import javax.swing.JFrame … … 9 10 import javax.swing.Action 10 11 import javax.swing.AbstractAction 11 import jp.gr.java_conf.mizu.util.ReflectionWrapper. _12 import jp.gr.java_conf.mizu.util.ReflectionWrapper.invoke 12 13 13 14 class GUIBuilder { … … 19 20 invoke(context, "set" + property.name.capitalize, value) 20 21 } 22 def asContainer :Container = { 23 context.value match { 24 case frame:JFrame => frame.getContentPane 25 case container:Container => container 26 } 27 } 21 28 def frame(params :Any*)(thunk : => Unit) : JFrame = { 22 29 val frame = new JFrame … … 30 37 def button(params :Any*) :JButton = { 31 38 val button = new JButton 32 context.value match { 33 case frame:JFrame => frame.getContentPane.add(button) 34 case container:Container => container.add(button) 35 } 39 asContainer.add(button) 36 40 params.foreach { 37 41 case text:String => button.setText(text) … … 48 52 new Dimension(width, height) 49 53 } 54 def layout(layoutManager :LayoutManager) { 55 asContainer.setLayout(layoutManager) 56 } 50 57 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)