- value:スライダーの値
- minimum:スライダーの最小値
- maximum:スライダーの最大値
- majorTickSpacing:スライダーのメジャー目盛幅
- minorTickSpacing:スライダーのマイナー目盛幅
- paintTicks:目盛表示
- paintLabels:ラベル表示
import java.awt.* import javax.swing.* import groovy.swing.* sb = new SwingBuilder() sb.edt { frame( title: "Slider example", show: true, resizable: true, pack: true, defaultCloseOperation: WindowConstants.EXIT_ON_CLOSE ){ slider(id:"slider1", value:50, minimum:0, maximum:100, majorTickSpacing:10, minorTickSpacing:5, paintTicks:true, paintLabels:true, constraints: BorderLayout.NORTH ) slider(id:"slider2", value:50, minimum:0, maximum:100, majorTickSpacing:10, minorTickSpacing:5, paintTicks:true, paintLabels:true, orientation: JSlider.VERTICAL, constraints: BorderLayout.CENTER ) button(text:"OK", constraints: BorderLayout.SOUTH, actionPerformed: { sb.optionPane( message:"slider1=${sb.slider1.value}, slider2=${sb.slider2.value}", messageType:JOptionPane.INFORMATION_MESSAGE) .createDialog("slider").visible = true } ) } }実行時画面
動作環境
groovy 2.2.2, JDK 1.7 update55
0 件のコメント:
コメントを投稿