use of javafx.scene.control.ScrollPane in project POL-POM-5 by PhoenicisOrg.
the class ApplicationPanel method populateCenter.
private void populateCenter() {
this.appDescription = new WebView();
this.appDescription.getEngine().loadContent("<body>" + application.getDescription() + "</body>");
themeManager.bindWebEngineStylesheet(appDescription.getEngine().userStyleSheetLocationProperty());
this.installers = new Label(tr("Installers"));
this.installers.getStyleClass().add("descriptionTitle");
this.scriptGrid = new GridPane();
filteredScripts.addListener((InvalidationListener) change -> this.refreshScripts());
this.refreshScripts();
this.miniaturesPane = new HBox();
this.miniaturesPane.getStyleClass().add("appPanelMiniaturesPane");
this.miniaturesPaneWrapper = new ScrollPane(miniaturesPane);
this.miniaturesPaneWrapper.getStyleClass().add("appPanelMiniaturesPaneWrapper");
for (URI miniatureUri : application.getMiniatures()) {
Region image = new Region();
image.getStyleClass().add("appMiniature");
image.setStyle(String.format("-fx-background-image: url(\"%s\");", miniatureUri.toString()));
image.prefHeightProperty().bind(miniaturesPaneWrapper.heightProperty().multiply(0.8));
image.prefWidthProperty().bind(image.prefHeightProperty().multiply(1.5));
miniaturesPane.getChildren().add(image);
}
this.center = new VBox(appDescription, installers, scriptGrid, miniaturesPaneWrapper);
VBox.setVgrow(appDescription, Priority.ALWAYS);
this.setCenter(center);
}
use of javafx.scene.control.ScrollPane in project bisq-desktop by bisq-network.
the class ProposalDisplay method getView.
public ScrollPane getView() {
ScrollPane scrollPane = new ScrollPane();
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
// just enough to display overview at voting without scroller
scrollPane.setMinHeight(280);
AnchorPane anchorPane = new AnchorPane();
scrollPane.setContent(anchorPane);
gridPane.setHgap(5);
gridPane.setVgap(5);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.SOMETIMES);
columnConstraints1.setMinWidth(140);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
columnConstraints2.setMinWidth(300);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
AnchorPane.setBottomAnchor(gridPane, 20d);
AnchorPane.setRightAnchor(gridPane, 10d);
AnchorPane.setLeftAnchor(gridPane, 10d);
AnchorPane.setTopAnchor(gridPane, 20d);
anchorPane.getChildren().add(gridPane);
return scrollPane;
}
use of javafx.scene.control.ScrollPane in project CSCI-6461-Simulator by lkstc112233.
the class NewMain method getScrollBox.
private Node getScrollBox(GridPane grid, String hint, ObservableValue<? extends String> binding) {
VBox box = new VBox();
box.getChildren().add(new Text(hint));
Text textBox = new Text();
textBox.textProperty().bind(binding);
ScrollPane scp = new ScrollPane(textBox);
box.getChildren().add(scp);
return box;
}
use of javafx.scene.control.ScrollPane in project JFoenix by jfoenixadmin.
the class JFXScrollPane method customScrolling.
private static void customScrolling(ScrollPane scrollPane, DoubleProperty scrollDriection, Function<Bounds, Double> sizeFunc) {
final double[] frictions = { 0.99, 0.1, 0.05, 0.04, 0.03, 0.02, 0.01, 0.04, 0.01, 0.008, 0.008, 0.008, 0.008, 0.0006, 0.0005, 0.00003, 0.00001 };
final double[] pushes = { 1 };
final double[] derivatives = new double[frictions.length];
Timeline timeline = new Timeline();
final EventHandler<MouseEvent> dragHandler = event -> timeline.stop();
final EventHandler<ScrollEvent> scrollHandler = event -> {
if (event.getEventType() == ScrollEvent.SCROLL) {
int direction = event.getDeltaY() > 0 ? -1 : 1;
for (int i = 0; i < pushes.length; i++) {
derivatives[i] += direction * pushes[i];
}
if (timeline.getStatus() == Animation.Status.STOPPED) {
timeline.play();
}
event.consume();
}
};
if (scrollPane.getContent().getParent() != null) {
scrollPane.getContent().getParent().addEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);
scrollPane.getContent().getParent().addEventHandler(ScrollEvent.ANY, scrollHandler);
}
scrollPane.getContent().parentProperty().addListener((o, oldVal, newVal) -> {
if (oldVal != null) {
oldVal.removeEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);
oldVal.removeEventHandler(ScrollEvent.ANY, scrollHandler);
}
if (newVal != null) {
newVal.addEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);
newVal.addEventHandler(ScrollEvent.ANY, scrollHandler);
}
});
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(3), (event) -> {
for (int i = 0; i < derivatives.length; i++) {
derivatives[i] *= frictions[i];
}
for (int i = 1; i < derivatives.length; i++) {
derivatives[i] += derivatives[i - 1];
}
double dy = derivatives[derivatives.length - 1];
double size = sizeFunc.apply(scrollPane.getContent().getLayoutBounds());
scrollDriection.set(Math.min(Math.max(scrollDriection.get() + dy / size, 0), 1));
if (Math.abs(dy) < 0.001) {
timeline.stop();
}
}));
timeline.setCycleCount(Animation.INDEFINITE);
}
use of javafx.scene.control.ScrollPane in project JFoenix by jfoenixadmin.
the class JFXResponsiveHandler method scanAllNodes.
/**
* scans all nodes in the scene and apply the css pseduoClass to them.
*
* @param parent stage parent node
* @param pseudoClass css class for certain device
*/
private void scanAllNodes(Parent parent, PseudoClass pseudoClass) {
parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() {
@Override
public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) {
while (c.next()) {
if (!c.wasPermutated() && !c.wasUpdated()) {
for (Node addedNode : c.getAddedSubList()) {
if (addedNode instanceof Parent) {
scanAllNodes((Parent) addedNode, pseudoClass);
}
}
}
}
}
});
for (Node component : parent.getChildrenUnmodifiable()) {
if (component instanceof Pane) {
((Pane) component).getChildren().addListener(new ListChangeListener<Node>() {
@Override
public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) {
while (c.next()) {
if (!c.wasPermutated() && !c.wasUpdated()) {
for (Node addedNode : c.getAddedSubList()) {
if (addedNode instanceof Parent) {
scanAllNodes((Parent) addedNode, pseudoClass);
}
}
}
}
}
});
// if the component is a container, scan its children
scanAllNodes((Pane) component, pseudoClass);
} else if (component instanceof ScrollPane) {
((ScrollPane) component).contentProperty().addListener((o, oldVal, newVal) -> {
scanAllNodes((Parent) newVal, pseudoClass);
});
// if the component is a container, scan its children
if (((ScrollPane) component).getContent() instanceof Parent) {
scanAllNodes((Parent) ((ScrollPane) component).getContent(), pseudoClass);
}
} else if (component instanceof Control) {
// if the component is an instance of IInputControl, add to list
component.pseudoClassStateChanged(PSEUDO_CLASS_EX_SMALL, pseudoClass == PSEUDO_CLASS_EX_SMALL);
component.pseudoClassStateChanged(PSEUDO_CLASS_SMALL, pseudoClass == PSEUDO_CLASS_SMALL);
component.pseudoClassStateChanged(PSEUDO_CLASS_MEDIUM, pseudoClass == PSEUDO_CLASS_MEDIUM);
component.pseudoClassStateChanged(PSEUDO_CLASS_LARGE, pseudoClass == PSEUDO_CLASS_LARGE);
}
}
}
Aggregations