本文整理汇总了Java中javafx.scene.control.ProgressBar.setMaxWidth方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.setMaxWidth方法的具体用法?Java ProgressBar.setMaxWidth怎么用?Java ProgressBar.setMaxWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.setMaxWidth方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupProgressBar
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
private void setupProgressBar() {
final VBox vbox = new VBox();
final ProgressBar browserProgressBar = new ProgressBar();
browserProgressBar.setVisible(false);
browserProgressBar.setMinHeight(PROGRESS_BAR_MIN_HEIGHT);
browserProgressBar.setMaxWidth(Double.MAX_VALUE);
vbox.getChildren().add(browserProgressBar);
this.browserRootBorderPane.setBottom(vbox);
final DoubleProperty progress = new SimpleDoubleProperty();
TwitchBrowserUpdateService.activeServicesProperty().addListener((observable, oldValue, newValue) -> {
final int size = observable.getValue().size();
if (size == 0) {
progress.set(1.0D);
browserProgressBar.setVisible(false);
} else {
browserProgressBar.setVisible(true);
progress.set(1.0D / observable.getValue().size());
}
});
browserProgressBar.progressProperty().bind(progress);
}
示例2: createContent
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
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;
}
示例3: createContent4
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
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;
}
示例4: SliderProgressBar
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
public SliderProgressBar() {
progressBar = new ProgressBar(0);
progressBar.setMaxWidth(Double.MAX_VALUE);
slider = new Slider();
slider.setMin(0);
slider.setMax(100);
getChildren().addAll(progressBar, slider);
}
示例5: addTradeInfoBlock
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
protected void addTradeInfoBlock() {
tradeInfoTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 4, Res.get("portfolio.pending.tradeInformation"));
txIdTextField = addLabelTxIdTextField(gridPane, gridRow, Res.getWithCol("shared.depositTransactionId"), Layout.FIRST_ROW_DISTANCE).second;
String id = model.dataModel.txId.get();
if (!id.isEmpty())
txIdTextField.setup(id);
else
txIdTextField.cleanup();
if (model.dataModel.getTrade() != null)
PaymentMethodForm.addOpenTradeDuration(gridPane, ++gridRow, model.dataModel.getTrade().getOffer(),
model.getDateForOpenDispute());
timeLeftTextField = addLabelTextField(gridPane, ++gridRow, Res.getWithCol("portfolio.pending.remainingTime")).second;
timeLeftProgressBar = new ProgressBar(0);
timeLeftProgressBar.setOpacity(0.7);
timeLeftProgressBar.setMinHeight(9);
timeLeftProgressBar.setMaxHeight(9);
timeLeftProgressBar.setMaxWidth(Double.MAX_VALUE);
GridPane.setRowIndex(timeLeftProgressBar, ++gridRow);
GridPane.setColumnIndex(timeLeftProgressBar, 1);
GridPane.setFillWidth(timeLeftProgressBar, true);
gridPane.getChildren().add(timeLeftProgressBar);
updateTimeLeft();
}
示例6: buildLoadingDialog
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
public static Node buildLoadingDialog()
{
BorderPane bp = init("Please wait", false);
bp.setCenter(new Label("Loading the database"));
ProgressBar pb = new ProgressBar(-1);
pb.setMaxWidth(Double.MAX_VALUE);
bp.setBottom(pb);
BorderPane.setMargin(bp.getCenter(), new Insets(20));
BorderPane.setMargin(bp.getBottom(), new Insets(0, 20, 20, 20));
bp.autosize();
return bp;
}
示例7: ProgressIndicatorBar
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
public ProgressIndicatorBar() {
bar = new ProgressBar();
text = new Text();
text.setId("progress-text");
bar.setMaxWidth(Double.MAX_VALUE);
getChildren().setAll(bar, text);
setAlignment(Pos.CENTER_LEFT);
}
示例8: createPreloaderScene
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
private Scene createPreloaderScene() {
ImageView splash = new ImageView(new Image(
getClass()
.getResourceAsStream("resources/splash.jpg")));
bar = new ProgressBar();
bar.setMaxWidth(Double.MAX_VALUE);
VBox.setVgrow(bar, Priority.NEVER);
VBox.setVgrow(splash, Priority.NEVER);
HBox.setHgrow(bar, Priority.ALWAYS);
VBox p = new VBox();
p.getChildren().add(splash);
p.getChildren().add(bar);
return new Scene(p);
}
示例9: SoundPlayer
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
/**
* Creates: a new sound player
*/
public SoundPlayer() {
play = new ToggleButton(PLAY);
play.selectedProperty().addListener((s, o, n) -> {
// If we have a player
if (player != null) {
if (n.booleanValue()) {
play.setText(PAUSE);
player.play();
} else {
play.setText(PLAY);
player.pause();
}
} else {
play.setSelected(false);
}
});
play.setFont(fontAwesome);
play.setPrefWidth(MEDIUM_WIDTH);
getChildren().add(play);
HBox.setHgrow(play, Priority.NEVER);
Label mute = new Label("\uf026");
Label loud = new Label("\uf028");
mute.setFont(fontAwesome);
loud.setFont(fontAwesome);
mute.setPrefWidth(SMALL_WIDTH);
loud.setPrefWidth(SMALL_WIDTH);
volume = new Slider(0, 1, 1);
volume.setPrefWidth(BIG_WIDTH);
mute.setAlignment(Pos.BASELINE_RIGHT);
getChildren().add(mute);
getChildren().add(volume);
getChildren().add(loud);
passed = new Label("00:00");
passed.setAlignment(Pos.BASELINE_RIGHT);
remaining = new Label("00:00");
passed.setPrefWidth(MEDIUM_WIDTH);
remaining.setPrefWidth(MEDIUM_WIDTH);
progress = new ProgressBar(0);
progress.setMaxWidth(Double.MAX_VALUE);
getChildren().add(passed);
HBox.setHgrow(passed, Priority.NEVER);
getChildren().add(progress);
HBox.setHgrow(progress, Priority.ALWAYS);
getChildren().add(remaining);
HBox.setHgrow(remaining, Priority.NEVER);
setAlignment(Pos.CENTER_LEFT);
setSpacing(10);
setMaxHeight(USE_PREF_SIZE);
setPadding(new Insets(10));
clear();
}
示例10: loadAllTrainingSamplesForProject
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
/**
* Update the retained image map by loading all image data within the project.
*/
private void loadAllTrainingSamplesForProject() {
Project<BufferedImage> project = qupath.getProject();
String title = "Load training from project";
if (project == null || project.isEmpty()) {
DisplayHelpers.showErrorMessage(title, "No project available!");
return;
}
if (!retainedObjectsMap.isEmpty()) {
if (!DisplayHelpers.showYesNoDialog(title, "The current retained training objects will be reset - do you want to continue?"))
return;
} else {
if (!DisplayHelpers.showYesNoDialog(title, "Are you sure you want to load training samples from all images in the project?\nThis may take some time."))
return;
}
ProgressBar progressBar = new ProgressBar();
Stage dialog = new Stage();
dialog.initOwner(qupath.getStage());
dialog.initModality(Modality.APPLICATION_MODAL);
TextArea textArea = new TextArea();
textArea.setPrefColumnCount(40);
textArea.setPrefRowCount(10);
textArea.setEditable(false);
// DefaultCaret caret = (DefaultCaret)textArea.getCaret();
// caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
TrainingLoadTask task = new TrainingLoadTask(dialog, textArea, retainedObjectsMap, project, paramsUpdate.getBooleanParameterValue("trainFromPoints"));
progressBar.progressProperty().bind(task.progressProperty());
BorderPane paneDialog = new BorderPane();
paneDialog.setPadding(new Insets(5, 5, 5, 5));
progressBar.setMaxWidth(Double.MAX_VALUE);
paneDialog.setTop(progressBar);
paneDialog.setCenter(textArea);
dialog.setTitle("Loading project training data");
dialog.setScene(new Scene(paneDialog));
qupath.createSingleThreadExecutor(this).submit(task);
panelClassifier.setCursor(Cursor.WAIT);
dialog.show();
}
示例11: classifyAllImagesInProject
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
private void classifyAllImagesInProject() {
Project<BufferedImage> project = qupath.getProject();
String title = "Apply classifier to project";
if (classifier == null || !classifier.isValid()) {
DisplayHelpers.showErrorMessage(title, "No valid classifier is available! Make sure to build a classifier first.");
return;
}
if (project == null || project.isEmpty()) {
DisplayHelpers.showErrorMessage(title, "No project available!");
return;
}
// Be cautious...
if (!DisplayHelpers.showYesNoDialog(title, "Are you sure you want to apply the current classifier to all images in the project?\nThis may take some time - and there is no 'undo'."))
return;
ProgressBar progressBar = new ProgressBar();
Stage dialog = new Stage();
dialog.setTitle("Classifying project images");
dialog.initOwner(qupath.getStage());
dialog.initModality(Modality.APPLICATION_MODAL);
TextArea textArea = new TextArea();
textArea.setPrefColumnCount(40);
textArea.setPrefRowCount(10);
textArea.setEditable(false);
Task<Void> task = new ClassificationTask(dialog, textArea, getFullClassifier(), project);
progressBar.progressProperty().bind(task.progressProperty());
BorderPane paneDialog = new BorderPane();
paneDialog.setPadding(new Insets(5, 5, 5, 5));
progressBar.setMaxWidth(Double.MAX_VALUE);
paneDialog.setTop(progressBar);
paneDialog.setCenter(textArea);
dialog.setScene(new Scene(paneDialog));
qupath.createSingleThreadExecutor(this).submit(task);
// task.execute();
panelClassifier.setCursor(Cursor.WAIT);
dialog.show();
panelClassifier.setCursor(Cursor.DEFAULT);
logger.info("Classification complete!");
}
示例12: createStatusBox
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
private Node createStatusBox() {
VBox status = new VBox(2);
status.setMaxWidth(240);
status.setMinWidth(240);
status.setPadding(new Insets(3, 3, 0, 5));
nameLabel = ComponentUtil.createCustomLabel("", "player-name-label", status);
titleLabel = ComponentUtil.createCustomLabel("", "player-title-label", status);
albumInfoLabel = ComponentUtil.createCustomLabel("", "player-albuminfo-label", status);
BorderPane statusBox = new BorderPane();
statusBox.getStyleClass().add("player-status-panel");
statusBox.setLeft(status);
HBox progressWrapper = new HBox(5);
progressWrapper.setPadding(new Insets(20, 10, 0, 0));
statusBox.setCenter(progressWrapper);
progress = new ProgressBar();
progress.setOpacity(0);
progress.setProgress(0);
progress.setMinWidth(280);
progress.setMaxWidth(280);
HBox durationWrapper = new HBox();
durationWrapper.setMinWidth(30);
durationWrapper.setAlignment(Pos.BASELINE_CENTER);
currentDurationLabel = ComponentUtil.createText("", "", durationWrapper);
HBox totalDurationWrapper = new HBox();
totalDurationWrapper.setAlignment(Pos.BASELINE_CENTER);
totalDurationWrapper.setMinWidth(30);
totalDurationLabel = ComponentUtil.createText("", "", totalDurationWrapper);
progressWrapper.getChildren().add(durationWrapper);
progressWrapper.getChildren().add(progress);
progressWrapper.getChildren().add(totalDurationWrapper);
HBox spacer = new HBox();
spacer.setMinWidth(10);
progressWrapper.getChildren().add(spacer);
return statusBox;
}
示例13: TaskStage
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
/**
* Creates a new task stage.
* @param stage the owner
* @param task the task to monitor
* @param title the title
* @param cancellable if it is cancellable
* @param modal if it should be modal
*/
public TaskStage(Stage stage, Task<?> task, String title, boolean cancellable, boolean modal)
{
this.task = task;
this.task.addEventHandler(WorkerStateEvent.WORKER_STATE_CANCELLED, event -> this.close());
this.task.addEventHandler(WorkerStateEvent.WORKER_STATE_FAILED, event -> this.close());
this.task.addEventHandler(WorkerStateEvent.WORKER_STATE_SUCCEEDED, event -> this.close());
this.cancellable = cancellable;
//setup stage
this.initOwner(stage);
this.initModality(modal ? Modality.APPLICATION_MODAL : Modality.NONE);
this.setResizable(false);
this.setMinWidth(350);
this.setTitle(title);
this.getIcons().add(new Image("/images/icons/task.png"));
this.setOnCloseRequest(event -> this.tryClose(event));
//root pane
BorderPane borderPane = new BorderPane();
//content pane
VBox contentPane = new VBox();
contentPane.setPadding(new Insets(10, 10, 10, 10));
contentPane.setSpacing(10);
borderPane.setCenter(contentPane);
//header label
Label headerLabel = new Label(title);
headerLabel.setFont(Fonts.LARGE);
contentPane.getChildren().add(headerLabel);
//description label
Label descriptionLabel = new Label();
descriptionLabel.textProperty().bind(this.task.messageProperty());
contentPane.getChildren().add(descriptionLabel);
//progress bar
ProgressBar progressBar = new ProgressBar();
progressBar.setMaxWidth(Double.MAX_VALUE);
progressBar.progressProperty().bind(this.task.progressProperty());
contentPane.getChildren().add(progressBar);
//buttons box
ButtonsBox buttonsBox = new ButtonsBox(false, true);
buttonsBox.setOnCancel(event -> this.task.cancel());
buttonsBox.getCancelButton().setDisable(!this.cancellable);
borderPane.setBottom(buttonsBox);
//show
this.setScene(new Scene(borderPane));
this.sizeToScene();
}
示例14: build
import javafx.scene.control.ProgressBar; //导入方法依赖的package包/类
public void build() {
final VBox controls=new VBox();
controls.getStyleClass().add("blank");
final Button butt=new Button("Check for updates");
final LogPane logPane= new LogPane();
//logPane.setPadding(new Insets(15, 12, 15, 12));
final ProgressBar bar= new ProgressBar();
bar.setVisible(false);
bar.setProgress(-1);
bar.setMaxWidth(this.getWidth()-50);
logPane.getStyleClass().add("messages");
butt.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
butt.setDisable(true);
bar.setVisible(true);
new Thread(){
public void run(){
try {
new Updater().update(logPane);
} catch (IOException e) {
e.printStackTrace();
logPane.error("Couldn't start the update process");
}finally{
Platform.runLater(new Runnable(){
public void run(){
butt.setDisable(false);
bar.setVisible(false);
}
});
}
}
}.start();
}
});
controls.getChildren().add(butt);
this.setTop(controls);
this.setCenter(bar);
this.setBottom(logPane);
}