2011年11月17日

Groovy + SwingBuilder 筆記 20111117

SwingBuilder 是 Groovy 開發視窗(GUI)程式的領域描述語言(DSL)。

文件


設定外觀(LookAndFell)

frame (...) {
  lookAndFeel('system') //配合各種作業系統的原生介面(推薦)
}

很棒的 actionPerformed 事件實作(使用 Groovy Closure)

button (text: 'Click Me', actionPerformed: {
  println "You hurt me."
})

很棒的表格布局(TableLayout)

tableLayout {
  tr {
    td {
      label (text: 'colname')
    }
    td {
      textField (text: 'something')
    }
  }
}

Ubuntu Unity 桌面會發生視窗標題列消失問題

frame (..., locationRelativeTo: null)

使用 Mac OS X 風格的選單(選單移到最上方)


System.setProperty("apple.laf.useScreenMenuBar", "true")

沒有留言:

張貼留言

lyhcode by lyhcode
歡迎轉載,請務必註明出處!