- constraints:カードの名称
サンプルコード
import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "card layout example", show: true, resizable: true, size: [300, 100], defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ panel(constraints: BorderLayout.NORTH){ button(text:"icon view", actionPerformed:{sb.views.getLayout().show(sb.views, "IconView")}) button(text:"list view", actionPerformed:{sb.views.getLayout().show(sb.views, "ListView")}) } panel(id:"views", constraints: BorderLayout.CENTER){ cardLayout() panel(constraints:'IconView'){ label(text:"icon view") } panel(constraints:'ListView'){ label(text:"list view") } } } }実行時画面
動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿