サンプルコード
import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "example - text pane", show: true, resizable: true, size: [300, 200], defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ scrollPane(){ textPane(id:"tp1", contentType:"text/html", editable:false, text:"""example<br><div bgcolor="#7799dd"><span color="white">line1</span></div><div bgcolor="#ccddff">line2</div>""", constraints: BorderLayout.CENTER ) } button(text:"OK", constraints: BorderLayout.SOUTH, actionPerformed: { sb.optionPane( message:"textarea=${sb.tp1.text}", messageType:JOptionPane.INFORMATION_MESSAGE) .createDialog("textarea").visible = true } ) } }実行時画面
動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿