Java Code Examples for javafx.scene.control.ProgressBar#setMaxWidth()

The following examples show how to use javafx.scene.control.ProgressBar#setMaxWidth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusPanel.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create a new status panel.
 * <p/>
 * @param group the group this panel is part of.
 * @param labelText the text to put on the label on this panel.
 * @param index the index of this panel on the group.
 */
StatusPanel(StatusPanelGroup group, String labelText, int index) {
    setAlignment(Pos.CENTER);
    setSpacing(5);
    this.group = group;
    this.index = index;
    label = new Label(labelText);
    label.setAlignment(Pos.CENTER);
    label.setMaxHeight(Double.MAX_VALUE);
    HBox.setMargin(label, new Insets(5));
    progressBar = new ProgressBar();
    progressBar.setMaxWidth(Double.MAX_VALUE); //Allow progress bar to fill space.
    HBox.setHgrow(progressBar, Priority.ALWAYS);
    cancelButton = new Button("", new ImageView(new Image("file:icons/cross.png", 13, 13, false, true)));
    Utils.setToolbarButtonStyle(cancelButton);
    cancelButton.setAlignment(Pos.CENTER);
    getChildren().add(label);
    getChildren().add(progressBar);
    getChildren().add(cancelButton);
}
 
Example 2
Source File: ModalCancellableStage.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public ModalCancellableStage(String displayText) {
    initModality(Modality.APPLICATION_MODAL);
    initStyle(StageStyle.UNDECORATED);
    setOnShowing((event) -> {
        centerOnScreen();
        cancel = false;
    });
    StackPane root = new StackPane();
    VBox items = new VBox(10);
    Label label = new Label(displayText);
    label.setAlignment(Pos.CENTER);
    items.getChildren().add(label);
    StackPane barPane = new StackPane();
    ProgressBar bar = new ProgressBar();
    bar.setMaxWidth(Double.MAX_VALUE);
    bar.prefWidthProperty().bind(widthProperty().subtract(50));
    StackPane.setAlignment(bar, Pos.CENTER);
    barPane.getChildren().add(bar);
    barPane.setAlignment(Pos.CENTER);
    items.getChildren().add(barPane);
    StackPane buttonPane = new StackPane();
    Button cancelButton = new Button(LabelGrabber.INSTANCE.getLabel("cancel.text"));
    StackPane.setAlignment(buttonPane, Pos.CENTER);
    buttonPane.setAlignment(Pos.CENTER);
    buttonPane.getChildren().add(cancelButton);
    cancelButton.setAlignment(Pos.CENTER);
    cancelButton.setOnAction((event) -> {
        cancel = true;
        hide();
        cancellable.cancelOp();
    });
    items.getChildren().add(buttonPane);
    StackPane.setMargin(items, new Insets(10));
    root.getChildren().add(items);
    Scene scene = new Scene(root);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);
}
 
Example 3
Source File: WikiProgressBar.java    From pattypan with MIT License 5 votes vote down vote up
private GridPane createContent(double progress) {
  this.progress = progress;
  this.setMinWidth(420);
  this.setMaxWidth(420);
  this.getStyleClass().add("mw-ui-progressbar-container");

  this.getColumnConstraints().addAll(
          Util.newColumn(33, "%", HPos.LEFT),
          Util.newColumn(33, "%", HPos.CENTER),
          Util.newColumn(33, "%", HPos.RIGHT));

  ProgressBar pb = new ProgressBar(progress);
  pb.getStyleClass().addAll("mw-ui-progressbar");
  pb.setMinWidth(420);
  pb.setMaxWidth(420);
  pb.setMaxHeight(5);
  this.add(pb, 0, 0, 3, 1);

  this.addRow(1,
          createDot(0.0, 1),
          createDot(1.0, 70),
          createDot(2.0, 140));

  this.addRow(2,
          createLabel(0.0, labels[0]).setTranslateByHalf(false),
          createLabel(1.0, labels[1]),
          createLabel(2.0, labels[2]).setTranslateByHalf(true)
  );
  return this;
}
 
Example 4
Source File: WikiProgressBar.java    From pattypan with MIT License 5 votes vote down vote up
private GridPane createContent4(double progress) {
  this.progress = progress;
  this.setMinWidth(420);
  this.setMaxWidth(420);
  this.getStyleClass().add("mw-ui-progressbar-container");

  this.getColumnConstraints().addAll(
          Util.newColumn(25, "%", HPos.LEFT),
          Util.newColumn(25, "%", HPos.CENTER),
          Util.newColumn(25, "%", HPos.CENTER),
          Util.newColumn(25, "%", HPos.RIGHT));

  ProgressBar pb = new ProgressBar(progress);
  pb.getStyleClass().addAll("mw-ui-progressbar");
  pb.setMinWidth(420);
  pb.setMaxWidth(420);
  pb.setMaxHeight(5);
  this.add(pb, 0, 0, 3, 1);

  this.addRow(1,
          createDot(0.0, 1),
          createDot(0.66, 33),
          createDot(1.32, 66),
          createDot(2.0, 100));

  this.addRow(2,
          createLabel(0.0, labels[0]).setTranslateByHalf(false),
          createLabel(0.66, labels[1]).setTranslateByHalf(false),
          createLabel(1.32, labels[2]).setTranslateByHalf(true),
          createLabel(2.0, labels[3]).setTranslateByHalf(true)
  );
  return this;
}
 
Example 5
Source File: ViewNumberProgress.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Node constructContent() {
    VBox vboxroot = new VBox();
    vboxroot.setSpacing(10.0);        
            
    boxview = new HBox();
    boxview.setSpacing(6.0);
    
    level = new Label();
    level.setAlignment(Pos.CENTER_RIGHT);
    level.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    level.getStyleClass().add("unitmaintext");
    HBox.setHgrow(level, Priority.SOMETIMES);
    
    boxview.getChildren().add(level);
    
    // Get all data

    progress = new ProgressBar();
    progress.getStyleClass().add("unitbar");
    progress.setFocusTraversable(false);
    progress.setMaxWidth(Double.MAX_VALUE);
    StackPane.setAlignment(progress, Pos.BOTTOM_CENTER);          

    StackPane stack = new StackPane(progress);
    VBox.setVgrow(stack, Priority.SOMETIMES);   
    vboxroot.getChildren().addAll(boxview, stack);
    
    initialize();
    return vboxroot;
}