余録:worldCup/scala/ex05/wcFrame.scala

  1: //..+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
  2: 
  3: /* ---------------------------------------- demo: scala
  4: cd /Users/sketch/home_sketch/worldCup/scala/
  5: 
  6: scalac ex05/wcFrame.scala
  7: scala WorldCup
  8: */
  9: 
 10: // ----------------------------------------
 11: import swing._
 12: 
 13: object WorldCup extends SimpleSwingApplication {
 14:   println("version: #1.0.30")
 15: 
 16:   def top = new MainFrame {
 17:     title = "FIFA World Cup #05"
 18:     contents = TopPanel
 19:   }
 20: }
 21: 
 22: // ----------------------------------------
 23: import javax.swing.ImageIcon
 24: 
 25: object TopPanel extends FlowPanel {
 26:   def _leftComponent = new Label {
 27:     icon = new ImageIcon("matches/wc2010logo.png")
 28:     text = "2010 FIFA World Cup South Africa"
 29:     horizontalAlignment = Alignment.Center
 30:     verticalTextPosition = Alignment.Top
 31:     horizontalTextPosition = Alignment.Center
 32:     preferredSize = new Dimension(120,150)
 33:   }
 34:   def _rightComponent = new Label {
 35:     icon = new ImageIcon("matches/fifa.png")
 36:     preferredSize = new Dimension(180,0)
 37:   }
 38:   contents += new SplitPane {
 39:     orientation = Orientation.Vertical
 40:     oneTouchExpandable = true
 41:     dividerLocation = 100
 42:     leftComponent  = _leftComponent
 43:     rightComponent = _rightComponent
 44:   }
 45: }
 46: 
 47: // ========================================