private void configureMask(){ StackPane maskContainer = new StackPane(); mask.setStyle("-fx-background-color:black;-fx-opacity:.2;"); mask.visibleProperty().bind(maskVisible); Label maskLbl = new Label(""); maskLbl.textProperty().bind(maskMessage); maskLbl.setStyle("-fx-font-size:15px;-fx-font-weight:bold;-fx-text-fill:white;"); HBox maskGrp = new HBox(); maskGrp.setAlignment(Pos.CENTER); maskGrp.setSpacing(10); maskGrp.getChildren().addAll(ProgressIndicatorBuilder.create().maxWidth(20).maxHeight(20).build() ,maskLbl); mask.getChildren().add(maskGrp); showMask("Loading...."); maskContainer.getChildren().addAll(mask,maskGrp); root.getChildren().add(maskContainer); }
/** * Instantiates a new {@link ImageDisplay}. * * @param f * The file to use to construct the Image. * @param owner * The owner of the image * @param index * The index of the image in the gallery */ public ImageDisplay(File f, final Gallery owner, final int index) { this.file = f; double prefSize = 65; this.progressIndicator = ProgressIndicatorBuilder.create().progress(-1.0).prefWidth(prefSize).prefHeight(prefSize) .build(); this.button = ButtonBuilder.create().alignment(Pos.CENTER).textAlignment(TextAlignment.CENTER) .contentDisplay(ContentDisplay.TOP).graphic(progressIndicator).build(); // setAlignment(Pos.CENTER); setPrefSize(125, 125); setCenter(button); if (LJGM.instance().getConfigManager().isDebug()) { button.setText(index + "; " + file.getName()); } EventHandler<MouseEvent> click = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { if (!(e.getButton() == MouseButton.PRIMARY)) { return; } FullScreenView view = new FullScreenView(owner, index); view.setImage(index); view.show(); } }; button.setOnMouseClicked(click); // This is necessary because if the user clicks on the progress // indicator while it's still loading, then the image will not be // displayed. progressIndicator.setOnMouseClicked(click); }
/** * Instantiates a new full screen image view. * * @param f The file to use */ public FullScreenImageView(File f) { this.file = f; this.progressIndicator = ProgressIndicatorBuilder.create().progress(-1.0).maxWidth(50).build(); this.imageView = new ImageView(); setCenter(progressIndicator); }