Enhancing applications with scrolling

We shouldn't omit a common but powerful way to present large chunks of information in smaller areas—scrolling.

In JavaFX, a ScrollPane layout manager provides a scrollable, clipped viewport of its content. Usage is conveniently simple—you can put any node or layout manager into ScrollPane using the setContent() method.

For example, let's put content from our previous sample into ScrollPane:

// chapter7/resizing/ScrollPaneDemo.java
FlowPane pane = new FlowPane();
pane.setOrientation(Orientation.VERTICAL);
ScrollPane root = new ScrollPane();
root.setContent(pane);

In the following screenshot, you can see the resulting scrollable view:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.9.169