サンプルコード
import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "example : text position", show: true, resizable: true, pack: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ label(text:"left", icon:imageIcon(file:"e:/icons/home.png"), horizontalTextPosition: JLabel.LEFT, constraints: BorderLayout.WEST ) label(text:"top", icon:imageIcon(file:"e:/icons/plane.png"), horizontalTextPosition: JLabel.CENTER, verticalTextPosition: JLabel.TOP, constraints: BorderLayout.NORTH ) label(text:"right", icon:imageIcon(file:"e:/icons/mobile2.png"), horizontalTextPosition: JLabel.RIGHT, constraints: BorderLayout.EAST ) label(text:"bottom", icon:imageIcon(file:"e:/icons/computer.png"), horizontalTextPosition: JLabel.CENTER, verticalTextPosition: JLabel.BOTTOM, constraints: BorderLayout.SOUTH ) } }実行時画面
動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿