余録:worldCup/scala/ex06/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 ex06/wcFrame.scala
  7: scala WorldCup
  8: */
  9: 
 10: // ----------------------------------------
 11: import swing._
 12: 
 13: object WorldCup extends SimpleSwingApplication {
 14:   println("version: #1.0.33")
 15: 
 16:   def top = new MainFrame {
 17:     title = "FIFA World Cup #06"
 18:     contents = TopPanel
 19:   }
 20: }
 21: 
 22: // ----------------------------------------
 23: import javax.swing.ImageIcon
 24: 
 25: object TopPanel extends FlowPanel {
 26:   def _leftComponent = {
 27:     def view = new Label {
 28:       icon = new ImageIcon("matches/wc2010logo.png")
 29:       text = "2010 FIFA World Cup South Africa"
 30:       horizontalAlignment = Alignment.Center
 31:       verticalTextPosition = Alignment.Top
 32:       horizontalTextPosition = Alignment.Center
 33:     }
 34:     new ScrollPane {
 35:       viewportView = view
 36:       preferredSize = new Dimension(120,150)
 37:     }
 38:   }
 39: 
 40:   def _rightComponent = {
 41:     def view = new Label {
 42:       icon = new ImageIcon("matches/fifa.png")
 43:     }
 44:     new ScrollPane {
 45:       viewportView = view
 46:       preferredSize = new Dimension(180,0)
 47:     }
 48:   }
 49:   contents += new SplitPane {
 50:     orientation = Orientation.Vertical
 51:     oneTouchExpandable = true
 52:     dividerLocation = 100
 53:     leftComponent  = _leftComponent
 54:     rightComponent = _rightComponent
 55:   }
 56: }
 57: 
 58: // ========================================