本文整理匯總了Java中javafx.scene.control.ProgressIndicator.setMaxSize方法的典型用法代碼示例。如果您正苦於以下問題:Java ProgressIndicator.setMaxSize方法的具體用法?Java ProgressIndicator.setMaxSize怎麽用?Java ProgressIndicator.setMaxSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.ProgressIndicator
的用法示例。
在下文中一共展示了ProgressIndicator.setMaxSize方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createRoot
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
private Parent createRoot() {
StackPane stackPane = new StackPane();
BorderPane controlsPane = new BorderPane();
controlsPane.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
stackPane.getChildren().add(controlsPane);
controlsPane.setCenter(new TableView<Void>());
ProgressIndicator indicator = new ProgressIndicator();
indicator.setMaxSize(120, 120);
stackPane.getChildren().add(indicator);
StackPane.setAlignment(indicator, Pos.BOTTOM_RIGHT);
StackPane.setMargin(indicator, new Insets(20));
return stackPane;
}
示例2: LoadingWindow
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
/**
* Create a new LoadingWindow.<br>
* First a progress indicator is created and set up. The progress indicator
* will turn indefinite. Then a label and a {@link ProgressBar} are shown.
* In the end, the WaitThread will be started which shows that still no
* connection has been established.
*/
public LoadingWindow() {
this.setId(LayerType.loading.toString()); // Sets the ID as "LOADING"
ProgressIndicator progressIndicator = new ProgressIndicator();
progressIndicator.setPrefSize(120, 120);
progressIndicator.setMaxSize(120, 120);
this.getStyleClass().add("loading");
this.setCenter(progressIndicator);
Label loadingLabel = new Label("Connecting...");
loadingLabel.setId("loadingLabel");
loadingLabel.setTextAlignment(TextAlignment.RIGHT);
StackPane sp = new StackPane();
sp.setAlignment(Pos.CENTER);
sp.getChildren().add(loadingLabel);
progressBar = new ProgressBar(0.0);
progressBar.setTranslateY(50);
sp.getChildren().add(progressBar);
new LoadingWindow.WaitThread().start();
setTop(sp);
}
示例3: DocumentViewerPage
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
public DocumentViewerPage(DocumentPageViewModel initialPage) {
page = initialPage;
imageView = new ImageView();
imageHolder = new StackPane();
imageHolder.getStyleClass().add("page");
// Show progress indicator
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(50, 50);
// Set empty background and create proper rendering in background (for smoother loading)
background = new Rectangle(getDesiredWidth(), getDesiredHeight());
background.setStyle("-fx-fill: WHITE");
//imageView.setImage(new WritableImage(getDesiredWidth(), getDesiredHeight()));
BackgroundTask<Image> generateImage = BackgroundTask
.wrap(() -> renderPage(initialPage))
.onSuccess(image -> {
imageView.setImage(image);
progress.setVisible(false);
background.setVisible(false);
});
taskExecutor.execute(generateImage);
imageHolder.getChildren().setAll(background, progress, imageView);
}
示例4: getPane
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
private StackPane getPane(BibEntry entry) {
StackPane root = new StackPane();
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(100, 100);
WebView browser = new WebView();
// Quick hack to disable navigating
browser.addEventFilter(javafx.scene.input.MouseEvent.ANY, javafx.scene.input.MouseEvent::consume);
browser.setContextMenuEnabled(false);
root.getChildren().addAll(browser, progress);
Optional<MathSciNetId> mathSciNetId = getMathSciNetId(entry);
mathSciNetId.flatMap(MathSciNetId::getExternalURI)
.ifPresent(url -> browser.getEngine().load(url.toASCIIString()));
// Hide progress indicator if finished (over 70% loaded)
browser.getEngine().getLoadWorker().progressProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.doubleValue() >= 0.7) {
progress.setVisible(false);
}
});
return root;
}
示例5: getPane
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
private StackPane getPane(BibEntry entry) {
StackPane root = new StackPane();
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(100, 100);
WebView browser = new WebView();
root.getChildren().addAll(browser, progress);
MrDLibFetcher fetcher = new MrDLibFetcher(Globals.prefs.get(JabRefPreferences.LANGUAGE),
Globals.BUILD_INFO.getVersion().getFullVersion());
BackgroundTask
.wrap(() -> fetcher.performSearch(entry))
.onRunning(() -> progress.setVisible(true))
.onSuccess(relatedArticles -> {
progress.setVisible(false);
browser.getEngine().loadContent(convertToHtml(relatedArticles));
})
.executeWith(Globals.TASK_EXECUTOR);
browser.getEngine().getLoadWorker().stateProperty().addListener(new OpenHyperlinksInExternalBrowser(browser));
return root;
}
示例6: TaskSample
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
public TaskSample() {
TableView<DailySales> tableView = new TableView<DailySales>();
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
StackPane stack = new StackPane();
stack.getChildren().addAll(tableView, veil, p);
// Use binding to be notified whenever the data source chagnes
Task<ObservableList<DailySales>> task = new GetDailySalesTask();
p.progressProperty().bind(task.progressProperty());
veil.visibleProperty().bind(task.runningProperty());
p.visibleProperty().bind(task.runningProperty());
tableView.itemsProperty().bind(task.valueProperty());
getChildren().add(stack);
new Thread(task).start();
}
示例7: init
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 800, 0, 0.3)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setMinWidth(150);
idCol.setCellValueFactory(new PropertyValueFactory<>("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setMinWidth(150);
qtyCol.setCellValueFactory(new PropertyValueFactory<>("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory<>("date"));
dateCol.setMinWidth(150);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
root.getChildren().add(stack);
service.start();
}
示例8: start
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
ProgressIndicator pi = new ProgressIndicator();
Task<Void> counter = new Task<Void>() {
@Override
public Void call() throws Exception {
for (int i = 1; i <= 100; i++) {
Thread.sleep(50);
updateProgress(i, 100);
}
return null;
}
};
pi.progressProperty().bind(counter.progressProperty());
pi.progressProperty().addListener((obs, oldProgress, newProgress) -> {
PseudoClass warning = PseudoClass.getPseudoClass("warning");
PseudoClass critical = PseudoClass.getPseudoClass("critical");
if (newProgress.doubleValue() < 0.3) {
pi.pseudoClassStateChanged(warning, false);
pi.pseudoClassStateChanged(critical, true);
} else if (newProgress.doubleValue() < 0.65) {
pi.pseudoClassStateChanged(warning, true);
pi.pseudoClassStateChanged(critical, false);
} else {
pi.pseudoClassStateChanged(warning, false);
pi.pseudoClassStateChanged(critical, false);
}
});
pi.setMaxSize(Control.USE_PREF_SIZE, Control.USE_PREF_SIZE);
root.setStyle("-fx-background-color: antiqueWhite;");
root.getChildren().add(pi);
Scene scene = new Scene(root, 400, 400);
scene.getStylesheets().add("/css/progress.css");
primaryStage.setScene(scene);
primaryStage.show();
new Thread(counter).start();
}
示例9: ServiceSample
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
public ServiceSample() {
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
getChildren().add(stack);
service.start();
}
示例10: init
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vbox = new VBox(5);
vbox.setPadding(new Insets(12));
TableView tableView = new TableView();
Button button = new Button("Refresh");
button.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
service.restart();
}
});
vbox.getChildren().addAll(tableView, button);
Region veil = new Region();
veil.setStyle("-fx-background-color: rgba(0, 0, 0, 0.4)");
ProgressIndicator p = new ProgressIndicator();
p.setMaxSize(150, 150);
//Define table columns
TableColumn idCol = new TableColumn();
idCol.setText("ID");
idCol.setCellValueFactory(new PropertyValueFactory("dailySalesId"));
tableView.getColumns().add(idCol);
TableColumn qtyCol = new TableColumn();
qtyCol.setText("Qty");
qtyCol.setCellValueFactory(new PropertyValueFactory("quantity"));
tableView.getColumns().add(qtyCol);
TableColumn dateCol = new TableColumn();
dateCol.setText("Date");
dateCol.setCellValueFactory(new PropertyValueFactory("date"));
dateCol.setMinWidth(240);
tableView.getColumns().add(dateCol);
p.progressProperty().bind(service.progressProperty());
veil.visibleProperty().bind(service.runningProperty());
p.visibleProperty().bind(service.runningProperty());
tableView.itemsProperty().bind(service.valueProperty());
StackPane stack = new StackPane();
stack.getChildren().addAll(vbox, veil, p);
root.getChildren().add(stack);
service.start();
}
示例11: getProgressIndicator
import javafx.scene.control.ProgressIndicator; //導入方法依賴的package包/類
/**
* Returns an indeterminate {@link ProgressIndicator} with the specified dimensions.
* <p>
* @param maxWidth the maximum width of the {@link ProgressIndicator}
* @param maxHeight the maximum height of the {@link ProgressIndicator}
* @return the created {@link ProgressIndicator}
*/
public static ProgressIndicator getProgressIndicator(double maxWidth, double maxHeight)
{
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(maxWidth, maxHeight);
return progress;
}