Search in sources :

Example 56 with ScrollPane

use of javafx.scene.control.ScrollPane in project graphysica by Graphysica.

the class Inspecteur method panneauDeroulantVertical.

/**
 * Construit un panneau déroulant strictement vertical.
 *
 * @return le panneau construit.
 */
private static ScrollPane panneauDeroulantVertical() {
    final ScrollPane panneau = new ScrollPane();
    panneau.setFitToWidth(true);
    return panneau;
}
Also used : ScrollPane(javafx.scene.control.ScrollPane)

Example 57 with ScrollPane

use of javafx.scene.control.ScrollPane in project TeachingInSimulation by ScOrPiOzzy.

the class ResourceViewer method createImageViewer.

/**
 * 创建图片浏览
 */
public void createImageViewer() {
    HTTPUtils utils = SpringUtil.getBean(HTTPUtils.class);
    // Image image = new Image("http://192.168.1.19:8082/Test/1516772514400.png");
    String url = utils.getFullPath(ResourceConsts.FTP_RES_PATH + resource.getPath());
    if (url == null) {
        return;
    }
    Image image = new Image(url);
    ImageView imageView = new ImageView(image);
    HBox box = new HBox(imageView);
    box.setAlignment(Pos.CENTER);
    ScrollPane scrollPane = new ScrollPane(box);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setPannable(true);
    double width = image.getWidth();
    double height = image.getHeight();
    DoubleProperty zoomProperty = new SimpleDoubleProperty(1);
    zoomProperty.addListener(observable -> {
        if (height * zoomProperty.get() > viewer.getHeight()) {
            return;
        }
        imageView.setFitWidth(width * zoomProperty.get());
        imageView.setFitHeight(height * zoomProperty.get());
    });
    scrollPane.addEventFilter(ScrollEvent.ANY, new EventHandler<ScrollEvent>() {

        @Override
        public void handle(ScrollEvent event) {
            double delta = event.getDeltaY() / 100;
            double zoom = zoomProperty.get();
            double zoomDelta = zoom + delta;
            if (zoomDelta < 0.5) {
                zoomProperty.set(0.5);
            } else if (zoomDelta > 2) {
                zoomProperty.set(2);
            } else {
                zoomProperty.set(zoomDelta);
            }
        }
    });
    viewer.getChildren().add(scrollPane);
}
Also used : HBox(javafx.scene.layout.HBox) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) ScrollEvent(javafx.scene.input.ScrollEvent) ScrollPane(javafx.scene.control.ScrollPane) ImageView(javafx.scene.image.ImageView) HTTPUtils(com.cas.sim.tis.util.HTTPUtils) Image(javafx.scene.image.Image) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty)

Example 58 with ScrollPane

use of javafx.scene.control.ScrollPane in project phoenicis by PhoenicisOrg.

the class StepRepresentationMessage method drawStepContent.

@Override
protected void drawStepContent() {
    Text textWidget = new Text(textToShow);
    textWidget.setId("stepText");
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setId("stepScrollPane");
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    scrollPane.setContent(new TextFlow(textWidget));
    this.addToContentPane(scrollPane);
    VBox.setVgrow(scrollPane, Priority.ALWAYS);
}
Also used : ScrollPane(javafx.scene.control.ScrollPane) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow)

Example 59 with ScrollPane

use of javafx.scene.control.ScrollPane in project phoenicis by PhoenicisOrg.

the class StepRepresentationPresentation method drawStepContent.

@Override
protected void drawStepContent() {
    final String title = this.getParentWizardTitle();
    VBox contentPane = new VBox();
    contentPane.setId("presentationBackground");
    Label titleWidget = new Label(title + "\n\n");
    titleWidget.setId("presentationTextTitle");
    Text textWidget = new Text(textToShow);
    textWidget.setId("presentationText");
    TextFlow flow = new TextFlow();
    flow.getChildren().add(textWidget);
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setId("presentationScrollPane");
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    scrollPane.setContent(flow);
    VBox.setVgrow(scrollPane, Priority.ALWAYS);
    contentPane.getChildren().add(scrollPane);
    getParent().getRoot().setCenter(contentPane);
}
Also used : ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) VBox(javafx.scene.layout.VBox)

Example 60 with ScrollPane

use of javafx.scene.control.ScrollPane in project phoenicis 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);
}
Also used : Button(javafx.scene.control.Button) WebView(javafx.scene.web.WebView) Label(javafx.scene.control.Label) Logger(org.slf4j.Logger) javafx.scene.layout(javafx.scene.layout) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) InvalidationListener(javafx.beans.InvalidationListener) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) Consumer(java.util.function.Consumer) ScrollPane(javafx.scene.control.ScrollPane) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) DetailsView(org.phoenicis.javafx.views.common.widgets.lists.DetailsView) PhoenicisFilteredList(org.phoenicis.javafx.views.common.lists.PhoenicisFilteredList) URI(java.net.URI) Tooltip(javafx.scene.control.Tooltip) ThemeManager(org.phoenicis.javafx.views.common.ThemeManager) ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) WebView(javafx.scene.web.WebView) URI(java.net.URI)

Aggregations

ScrollPane (javafx.scene.control.ScrollPane)71 VBox (javafx.scene.layout.VBox)18 Text (javafx.scene.text.Text)15 Scene (javafx.scene.Scene)14 Label (javafx.scene.control.Label)13 Insets (javafx.geometry.Insets)11 Button (javafx.scene.control.Button)11 BorderPane (javafx.scene.layout.BorderPane)11 HBox (javafx.scene.layout.HBox)10 GridPane (javafx.scene.layout.GridPane)9 TextFlow (javafx.scene.text.TextFlow)8 FXCollections (javafx.collections.FXCollections)7 Node (javafx.scene.Node)7 TextArea (javafx.scene.control.TextArea)7 javafx.scene.layout (javafx.scene.layout)7 Pane (javafx.scene.layout.Pane)7 InvalidationListener (javafx.beans.InvalidationListener)6 Observable (javafx.beans.Observable)6 ObservableList (javafx.collections.ObservableList)6 Alert (javafx.scene.control.Alert)6