This repository was archived by the owner on Jul 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Views
Giorgio Garofalo edited this page Feb 5, 2021
·
5 revisions
In Chorus, a view is an additional window. From JavaScript, a view can be instantiated by calling View(title, image, width, height, isResizable).
-
titleis a string that represents the title on the top of the window -
imageis anImage(path)instance which represents the window icon. Can benullfor no icon -
widthandheightrepresent initial size of the window -
isResizabledefines whether the window can be manually resized or not.
When a View is instantiated, the internal components are generated. Then you just need to show it by calling View#setRoot(root), where root is a JavaFX node.
const image = new Image('chorus.png'); // Starts from add-on folder
const view = new View('Example view', image, 500, 300, false);
const vbox = new VBox();
vbox.setAlignment(Alignment.CENTER);
const imageView = new ImageView(image);
imageView.setPreserveRatio(true);
imageView.setFitHeight(view.getHeight());
vbox.getChildren().add(imageView);
vbox.getStyleClass().add('pane'); // "pane" is an internally styled class
view.setRoot(vbox);