import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "Textfield example", show: true, resizable: true, pack: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ textField(id:"tf1", text:"example textfield1", constraints: BorderLayout.NORTH ) textField(id:"tf2", text:"example textfield2", constraints: BorderLayout.CENTER ) button(text:"OK", constraints: BorderLayout.SOUTH, actionPerformed: { sb.optionPane( message:"textfield1=${sb.tf1.text}, textfield2=${sb.tf2.text}", messageType:JOptionPane.INFORMATION_MESSAGE) .createDialog("textfield").visible = true } ) } }実行時画面
動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿