Scrolls with ScrollPane : ScrollPane « JavaFX « Java

Scrolls with ScrollPane


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

public class Main extends Application {
    public void start(Stage stage) {
        Group root = new Group();
        Scene scene = new Scene(root, 500, 200);

        Rectangle rect = new Rectangle(200, 200, Color.RED);
        ScrollPane s1 = new ScrollPane();
        s1.setPrefSize(120, 120);

    public static void main(String[] args) {


Related examples in the same category

1.Add class noborder-scroll-pane to ScrollPane
2.Set ScrollPane to fit to width
3.ScrollPane vertical value and horizontal value change listener