Skip to content

Commit

Permalink
Samples: add icon and banner to sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
wirew0rm committed Sep 25, 2023
1 parent 7983b4e commit 626bb74
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import javafx.stage.Window;

import org.scenicview.ScenicView;

Expand Down Expand Up @@ -46,7 +49,8 @@ public String getSampleBasePackage() {
public WelcomePage getWelcomePage() {
VBox vBox = new VBox();
ImageView imgView = new ImageView();
// imgView.setStyle("-fx-image: url('org/controlsfx/samples/ControlsFX.png');");
imgView.setImage(new Image(ChartFxSamplerProject.class.getResourceAsStream("banner.png")));
// imgView.setStyle("-fx-image: url('banner.png');");
StackPane pane = new StackPane();
pane.setPrefHeight(207);
// pane.setStyle("-fx-background-image: url('org/controlsfx/samples/bar.png');"
Expand All @@ -58,6 +62,17 @@ public WelcomePage getWelcomePage() {
label.setStyle("-fx-font-size: 1.5em; -fx-padding: 20 0 0 5;");
vBox.setStyle("-fx-padding: 5px; -fx-spacing: 5px");

// set window icon
vBox.sceneProperty().addListener(((obs, o, n) -> {
if (n != null) {
Window window = n.getWindow();
if (window instanceof Stage) {
Stage stage = (Stage) window;
stage.getIcons().add(new Image(ChartFxSamplerProject.class.getResourceAsStream("icon.png")));
}
}
}));

var scenicView = new Button("Show ScenicView");
scenicView.setOnAction(a -> ScenicView.show(scenicView.getScene()));

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 626bb74

Please sign in to comment.