Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

PositionLayout in Scala

By: fedarius on Aug 7th, 2011  |  syntax: Scala  |  size: 0.79 KB  |  views: 86  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. object PositionTest extends Frame {
  2.   val button1 = new Button("Button")
  3.   val button2 = new Button("Button")
  4.  
  5.   val positionPanel = new PositionPanel {
  6.     add(button1,
  7.       Seq((PositionPanel.Property.Left, 10), (PositionPanel.Property.Right, .5f),
  8.           (PositionPanel.Property.Top, 10), (PositionPanel.Property.Bottom, 10)))
  9.    
  10.     add(button2,
  11.       Seq((PositionPanel.Property.HCenter, .125f), (PositionPanel.Property.Top, 10),
  12.           (PositionPanel.Property.Height, .25f), (PositionPanel.Property.Width, .25f)))
  13.   }
  14.  
  15.   title = "Test"
  16.   preferredSize = new Dimension(300, 200)
  17.   contents = positionPanel
  18.    
  19.   def main (args: Array[String]): Unit = {
  20.     PositionTest.visible = true
  21.    
  22.     println (PositionTest.button1)
  23.     println (PositionTest.button2)
  24.   }
  25. }