第71讲 Scala界面Panel、Layout

实例代码如下

/** * Created by zhiwang on 2015/7/28. */
import scala.swing.SimpleSwingApplication
import scala.swing.MainFrame
import scala.swing.Button
import scala.swing.Label
import scala.swing.Orientation
import scala.swing.BoxPanel
import scala.swing.Swing

object GUI_Panel_Layout extends SimpleSwingApplication{
  def top = new MainFrame{
    title = "Second GUI"
    val button = new Button{
      text = "Scala"
    }
    val label = new Label {
      text = "Here is Spark!!"
    }

    contents = new BoxPanel(Orientation.Vertical){
      contents += button
      contents += label
      border = Swing.EmptyBorder(50,50,50,50)
    }
  }
}

运行效果
第71讲 Scala界面Panel、Layout_第1张图片

参考文档
百度网盘:http://pan.baidu.com/share/home?uk=4013289088#category/type=0
微信号:18610086859
DT大数据微信公众账号:DT_Spark
DT大数据梦工厂交流群:462923555/418110145/437123764

你可能感兴趣的:(scala,Panel)