javafx ScrollPane B) Dynamic content's size :

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

The size of the content will change depending on the added elements that exceed the content limits in both axes (horizontal and vertical) that can be seen by moving through the view.

import javafx.scene.control.ScrollPane;   //Import the ScrollPane
import javafx.scene.control.ScrollPane.ScrollBarPolicy; //Import the ScrollBarPolicy
import javafx.scene.layout.Pane;

ScrollPane scrollpane;
Pane content = new Pane();  //We will use this Pane as a content

scrollpane = new ScrollPane();  
scrollpane.setPrefSize(300, 300);   //Initialize the size of the ScrollPane
content.setMinSize(300,300); //Here a minimum size is set so that the container can be extended.
scrollpane.setContent(content); // we add the content to the ScrollPane

Note : Here we don't need both methods (setFitToWidth/setFitToHeight).



Got any javafx Question?