import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "Checkbox example", show: true, resizable: true, pack: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ // label -> 表示文字列 checkBox(id:"chk1", label:"example checkbox1", constraints: BorderLayout.NORTH ) // selected -> 選択状態 checkBox(id:"chk2", label:"example checkbox2", selected:true, constraints: BorderLayout.CENTER ) button(text:"OK", constraints: BorderLayout.SOUTH, actionPerformed: { sb.optionPane( message:"checkbox1=${sb.chk1.selected}, checkbox2=${sb.chk2.selected}", messageType:JOptionPane.INFORMATION_MESSAGE) .createDialog("checkbox").visible = true } ) } }実行時画面
動作環境
groovy 2.1.7, JDK 1.7
0 件のコメント:
コメントを投稿