/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package sliderscrollbarclick; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Slider; import javafx.scene.control.ScrollBar; import javafx.scene.paint.Color; import javafx.stage.Stage; /** * @author mickf */ public class Main extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { Application.launch(args); } Slider slider; ScrollBar sBar; @Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 600, 450); scene.setFill(Color.CHOCOLATE); Group root = (Group)scene.getRoot(); slider = new Slider(); slider.setPrefSize(150, 10); slider.setLayoutX(25); slider.setLayoutY(40); slider.setVisible(true); root.getChildren().add(slider); sBar = new ScrollBar(); sBar.setPrefSize(150, 10); sBar.setLayoutX(25); sBar.setLayoutY(240); sBar.setVisible(true); root.getChildren().add(sBar); stage.setScene(scene); stage.setVisible(true); } }