本文整理汇总了Java中javafx.scene.control.ProgressBar类的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar类的具体用法?Java ProgressBar怎么用?Java ProgressBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBar类属于javafx.scene.control包,在下文中一共展示了ProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Resource
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
private Resource(Scene start, String name, int startCost, long value, long delay, double mult, final MoneyListener listener){
System.out.println(name);
this.prog = (ProgressBar) start.lookup("#" + name + "_progress");
this.made = (Label) start.lookup("#" + name + "_money");
this.buy = (Button) start.lookup("#" + name + "_buy");
this.multiply = mult;
this.name = name;
this.print = (name.charAt(0) + "").toUpperCase() + name.substring(1);
this.value = value;
this.cost = startCost;
this.delay = delay;
this.listener = listener;
setText(made, print + " Earnings: " + format.format(money));
setText(buy, "(" + miners + ") Buy Miner: " + format.format((long)cost));
this.buy.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
listener.buyMiner(Resource.this.name);
}
});
}
示例2: start
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
@Override
public void start(Stage stage) {
Group root = new Group();
Scene scene = new Scene(root, 300, 250);
stage.setScene(scene);
stage.setTitle("Progress Controls");
for (int i = 0; i < values.length; i++) {
final Label label = labels[i] = new Label();
label.setText("progress:" + values[i]);
final ProgressBar pb = pbs[i] = new ProgressBar();
pb.setProgress(values[i]);
final ProgressIndicator pin = pins[i] = new ProgressIndicator();
pin.setProgress(values[i]);
final HBox hb = hbs[i] = new HBox();
hb.setSpacing(5);
hb.setAlignment(Pos.CENTER);
hb.getChildren().addAll(label, pb, pin);
}
final VBox vb = new VBox();
vb.setSpacing(5);
vb.getChildren().addAll(hbs);
scene.setRoot(vb);
stage.show();
}
示例3: NotificationBarPane
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
public NotificationBarPane(Node content) {
super(content);
progressBar = new ProgressBar();
label = new Label("infobar!");
bar = new HBox(label);
bar.setMinHeight(0.0);
bar.getStyleClass().add("info-bar");
bar.setFillHeight(true);
setBottom(bar);
// Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
sceneProperty().addListener(o -> {
if (getParent() == null) return;
getParent().applyCss();
getParent().layout();
barHeight = bar.getHeight();
bar.setPrefHeight(0.0);
});
items = FXCollections.observableArrayList();
items.addListener((ListChangeListener<? super Item>) change -> {
config();
showOrHide();
});
}
示例4: init
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
public void init() {
ImageView splash = new ImageView(new Image(
SPLASH_IMAGE
));
loadProgress = new ProgressBar();
loadProgress.setPrefWidth(SPLASH_WIDTH - 20);
loadProgress.setStyle("-fx-padding: 10; ");
progressText = new Label("Loading Chess Bot");
splashLayout = new VBox();
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
progressText.setAlignment(Pos.CENTER);
splashLayout.setStyle(
"-fx-padding: 10; "
+ "-fx-background-color: white; "
+ "-fx-border-width:3; "
+ "-fx-border-color: "
+ "linear-gradient("
+ "to bottom, "
+ "chocolate, "
+ "derive(chocolate, 50%)"
+ ");"
);
splashLayout.setEffect(new DropShadow());
}
示例5: createPreloaderScene
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
private Scene createPreloaderScene() {
splash = new ImageView(new Image(SPLASH_IMAGE));
loadProgress = new ProgressBar();
loadProgress.setPrefWidth(SPLASH_WIDTH);
progressText = new Label();
progressText.setAlignment(Pos.CENTER);
progressText.setStyle("-fx-font-weight: bold; -fx-fill: rgb(43,43,43);");
splashLayout = new VBox(10);
splashLayout.getChildren().addAll(splash, loadProgress, progressText);
splashLayout.setAlignment(Pos.CENTER);
splashLayout.setPadding(new Insets(10, 5, 5, 5));
splash.setEffect(new DropShadow());
progressText.setEffect(new DropShadow(4, Color.rgb(133, 191, 37)));
Scene scene = new Scene(splashLayout, SPLASH_WIDTH, SPLASH_HEIGHT, Color.TRANSPARENT);
scene.getStylesheets().add("css/styles.css");
return scene;
}
示例6: LoadingStage
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
public LoadingStage(String title, String noticeText) {
this.setWidth(WIDTH);
this.setHeight(HEIGHT);
this.setTitle(title);
progressBar = new ProgressBar();
this.notice = new Label(noticeText);
BorderPane mainPane = new BorderPane();
Scene s = new Scene(mainPane);
progressBar.setPrefWidth(WIDTH - 25);
mainPane.setTop(notice);
mainPane.setCenter(progressBar);
mainPane.setPadding(new Insets(15));
this.setScene(s);
}
示例7: start
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
@Override
public void start(final Stage primaryStage) throws IOException, UIInitialisationException {
stage = primaryStage;
primaryStage.setTitle(Hygene.TITLE);
primaryStage.initStyle(StageStyle.UNDECORATED);
progress = new ProgressBar();
final URL resource = getClass().getResource(PRELOADER_VIEW);
final Parent root = FXMLLoader.load(resource);
if (root == null) {
throw new UIInitialisationException("Root of Preloader could not be found.");
}
final Scene rootScene = new Scene(root);
primaryStage.setScene(rootScene);
primaryStage.show();
}
示例8: getText
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
@Test public void getText() {
ProgressBar progressBar = (ProgressBar) getPrimaryStage().getScene().getRoot().lookup(".progress-bar");
LoggingRecorder lr = new LoggingRecorder();
List<String> text = new ArrayList<>();
Platform.runLater(() -> {
RFXProgressBar rfxProgressBar = new RFXProgressBar(progressBar, null, null, lr);
progressBar.setProgress(0.56);
rfxProgressBar.mouseReleased(null);
text.add(rfxProgressBar.getAttribute("text"));
});
new Wait("Waiting for progress bar text.") {
@Override public boolean until() {
return text.size() > 0;
}
};
AssertJUnit.assertEquals("0.56", text.get(0));
}
示例9: initialize
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
ui.setProgressBarScene(this);
for (int i = 0; i < progressBarArray.length; i++) {
if (ui.getMainScene().getProgressBarStageArray()[i] == null) {
index = i;
break;
}
}
number++;
textArray[index] = text;
if (RetrofitDownloadData.isDownloading) {
textArray[index].setText("Downloading");
}
progressBarArray[index] = progressBar;
progressBarArray[index].setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}
示例10: updateModule
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
private void updateModule(Group group, BatteryModule module) {
//System.out.println(group.getChildren());
//voltage, percentage, progressbar, name(is ok)
Label moduleVolt = (Label) group.getChildren().get(0);
Label modulePercent = (Label) group.getChildren().get(1);
ProgressBar progress = (ProgressBar) group.getChildren().get(2);
Label averageTemperature = (Label) group.getChildren().get(4);
double progressValue = ((module.getVoltage() - 48) / (66.666 - 48));
int percentage = (int) (progressValue * 100);
moduleVolt.setText(module.getVoltageAsString());
modulePercent.setText(percentage + " %");
progress.setProgress(progressValue);
// if(module.getId()==1){
// System.out.println("module 1 average temp: "+module.getAverageTemperatureAsString());
// }
averageTemperature.setText(module.getAverageTemperatureAsString());
}
示例11: updateCell
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
private void updateCell(Group cellDisp, BatteryCell cell) {
//disp: V, %, progressbar, name
Label voltage = (Label) cellDisp.getChildren().get(0);
Label percentage = (Label) cellDisp.getChildren().get(1);
ProgressBar progressBar = (ProgressBar) cellDisp.getChildren().get(2);
Label temperature = (Label) cellDisp.getChildren().get(4);
double progress = (double) cell.getStateOfCharge();
int percent = (int) (progress);
voltage.setText(cell.getVoltageAsString());
percentage.setText(percent + " %");
progressBar.setProgress(progress / 100);
// System.out.println("cell id: " + cell.getId());
temperature.setText(cell.getTemperatureAsString());
}
示例12: TalkWithSMTP
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
public TalkWithSMTP(Domain domain) {
this.domain = domain;
hbox = new HBox();
midProgress = new ProgressBar();
midProgress.setProgress(0.0d);
progresLabel = new Label(domain.getName());
List<String> inside = new ArrayList<>();
int count = 0;
for (String email : domain.getEmails()) {
if (count == 10) {
count = 0;
this.emails.add(new ArrayList<>(inside));
inside.clear();
}
inside.add(email);
count++;
}
}
示例13: LoadingProgressDisplay
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
/**
* Creates a UI display monitor for provided worker.
*
* Assumes the worker is reporting progress as work done on a scale from 0 to 100 (other values indicate indeterminate progress).
*
* @param worker the worker whose progress is to be monitored and displayed.
*/
public LoadingProgressDisplay(Worker worker) {
setMaxWidth(Double.MAX_VALUE);
ColorAdjust bleach = new ColorAdjust();
bleach.setSaturation(-0.6);
setEffect(bleach);
HBox.setHgrow(this, Priority.ALWAYS);
visibleProperty().bind(worker.runningProperty());
// as the webview load progresses update progress.
worker.workDoneProperty().addListener((observableValue, oldNumber, newNumber) -> {
if (newNumber == null) newNumber = -1.0;
final double newValue = newNumber.doubleValue();
if (newValue < 0.0 || newValue > 100.0) {
setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}
setProgress(newValue / 100.0);
});
}
示例14: createUI
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
private void createUI() {
ProgressBar hpBar = new ProgressBar();
hpBar.setTranslateX(50);
hpBar.setTranslateY(50);
hpBar.setStyle("-fx-accent: rgb(0, 255, 0);");
hpBar.progressProperty().bind(player.health.divide(10.0f));
ProgressBar gBar = new ProgressBar();
gBar.setTranslateX(50);
gBar.setTranslateY(75);
gBar.progressProperty().bind(player.power.divide(player.maxPower.multiply(1.0f)));
Text score = new Text();
score.setTranslateX(50);
score.setTranslateY(25);
score.setFont(Config.FONT);
score.setFill(Color.GOLD);
score.textProperty().bind(player.score.asString());
UI_ROOT.getChildren().setAll(score, hpBar, gBar, createInfo());
}
示例15: start
import javafx.scene.control.ProgressBar; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
logger.debug("Starting Preloader");
preloaderStage = primaryStage;
VBox loading = new VBox(20);
loading.setMaxWidth(Region.USE_PREF_SIZE);
loading.setMaxHeight(Region.USE_PREF_SIZE);
ProgressBar progressBar = new ProgressBar();
progressBar.setPrefWidth(240);
loading.getChildren().add(progressBar);
infoLabel = new Label("Initializing application...");
loading.getChildren().add(infoLabel);
BorderPane root = new BorderPane(loading);
Scene scene = new Scene(root);
primaryStage.setWidth(300);
primaryStage.setHeight(150);
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setScene(scene);
primaryStage.show();
}