/**
*
* @author Joko Adianto
*/
public class JavaFXSlider2 extends Application {
Slider slider[] = new Slider[5];
HBox box;
{
box = new HBox();
int j = 0;
while(j<slider.length){
slider[j] = new Slider(-12,12,1);
box.getChildren().add(slider[j]);
slider[j++].setOrientation(Orientation.VERTICAL);
}
}
@Override
public void start(Stage primaryStage) throws Exception {
box.setAlignment(Pos.CENTER);
HBox.setHgrow(slider[4], Priority.ALWAYS);
Scene myScene = new Scene(box);
primaryStage.setScene(myScene);
primaryStage.setTitle("Contoh Membuat Banyak Slider dengan loop");
primaryStage.setWidth(600);
primaryStage.setHeight(600);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
No comments:
Post a Comment