Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.
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).

  • title is a string that represents the title on the top of the window
  • image is an Image(path) instance which represents the window icon. Can be null for no icon
  • width and height represent initial size of the window
  • isResizable defines 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);

Result

Clone this wiki locally