不知道为什么我的背景颜色没有出现?我在每个面板中设置了不透明度,我是否必须在 MainFrame 内容部分做其他事情?
// See http://www.artima.com/pins1ed/gui-programming.html
import scala.swing._
import java.awt.Color
object SecondSwingApp extends SimpleGUIApplication {
def top = new MainFrame {
title = "Second Swing App"
val dealerPanel = new BoxPanel(Orientation.Horizontal) {
background = new java.awt.Color(35, 125, 35)
preferredSize = new java.awt.Dimension(800, 200)
opaque = true
}
val botPlayerPanel = new BoxPanel(Orientation.Horizontal) {
background = new java.awt.Color(35, 125, 125)
preferredSize = new java.awt.Dimension(800, 200)
opaque = true
}
val humanPlayerPanel = new BoxPanel(Orientation.Horizontal) {
background = new java.awt.Color(125, 125, 35)
preferredSize = new java.awt.Dimension(800, 200)
opaque = true
}
contents = new BoxPanel(Orientation.Vertical) {
contents += dealerPanel
contents += botPlayerPanel
contents += humanPlayerPanel
}
}
}