Zoeken…


Invoering

Het ScrollPane is een besturingselement dat een dynamische weergave van de inhoud biedt. Deze weergave wordt op verschillende manieren beheerd; (knop voor toename / afname / muiswiel) voor een integraal beeld van de inhoud.

A) Grootte van vaste inhoud:

De grootte van de inhoud is hetzelfde als die van de ScrollPane-container.

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(content);  //Initialize and add content as a parameter
scrollpane.setPrefSize(300, 300);   //Initialize the size of the ScrollPane

scrollpane.setFitToWidth(true);  //Adapt the content to the width of ScrollPane
scrollpane.setFitToHeight(true); //Adapt the content to the height of ScrollPane


scrollpane.setHbarPolicy(ScrollBarPolicy.ALWAYS);  //Control the visibility of the Horizontal ScrollBar
scrollpane.setVbarPolicy(ScrollBarPolicy.NEVER);  //Control the visibility of the Vertical ScrollBar
//There are three types of visibility (ALWAYS/AS_NEEDED/NEVER)

B) Grootte van dynamische inhoud:

De grootte van de inhoud zal veranderen afhankelijk van de toegevoegde elementen die de inhoudslimieten in beide assen (horizontaal en verticaal) overschrijden die kunnen worden gezien door door het beeld te bewegen.

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

Opmerking: hier hebben we niet beide methoden nodig (setFitToWidth / setFitToHeight).

Het ScrollPane stileren:

Het uiterlijk van het ScrollPane kan eenvoudig worden gewijzigd, door enkele noties van " CSS " te hebben en enkele controle " eigenschappen " te respecteren en natuurlijk enige " verbeelding " te hebben.

A) De elementen waaruit ScrollPane bestaat:

Ik bezit de originele foto niet, hij is van orakel

B) CSS-eigenschappen:

.scroll-bar:vertical .track{}

.scroll-bar:horizontal .track{}

.scroll-bar:horizontal .thumb{}

.scroll-bar:vertical .thumb{}


.scroll-bar:vertical *.increment-button,
.scroll-bar:vertical *.decrement-button{}

.scroll-bar:vertical *.increment-arrow .content, 
.scroll-bar:vertical *.decrement-arrow .content{}

.scroll-bar:vertical *.increment-arrow, 
.scroll-bar:vertical *.decrement-arrow{}


.scroll-bar:horizontal *.increment-button,
.scroll-bar:horizontal *.decrement-button{}

.scroll-bar:horizontal *.increment-arrow .content, 
.scroll-bar:horizontal *.decrement-arrow .content{}

.scroll-bar:horizontal *.increment-arrow, 
.scroll-bar:horizontal *.decrement-arrow{}

.scroll-pane .corner{}

.scroll-pane{}


Modified text is an extract of the original Stack Overflow Documentation
Licentie onder CC BY-SA 3.0
Niet aangesloten bij Stack Overflow