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); } }); }
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); }
@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(); }
@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(); }
@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)); }
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(); }); }
@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); }
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()); }
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()); }
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()); }
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++; } }
/** * 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); }); }
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()); }
@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(); }
@Override public void init() { ImageView splash = new ImageView(new Image( SPLASH_IMAGE, SPLASH_WIDTH, SPLASH_HEIGHT, true, true )); loadProgress = new ProgressBar(0); loadProgress.setPrefWidth(SPLASH_WIDTH); progressText = new Label("Initializing . . ."); progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE,new CornerRadii(5),new Insets(0)))); splashLayout = new VBox(); splashLayout.getChildren().addAll(splash, loadProgress, progressText); progressText.setAlignment(Pos.CENTER); splashLayout.setBackground(Background.EMPTY); }
public Node getDisplay() { VBox box = new VBox(); box.setAlignment(Pos.CENTER); Text title = new Text(achievement.getTitle()); title.setFont(Font.font(20)); Text desc = new Text(achievement.getDescription()); Integer progress = achievement.getProgress(); ProgressBar bar = new ProgressBar(progress*1.0/100); Tooltip.install(bar,new Tooltip("["+progress+"%] "+achievement.getHint())); box.getChildren().add(title); box.getChildren().add(image); if(achievement.isUnlocked()) box.getChildren().add(desc); else box.getChildren().add(bar); return box; }
public Mp3ImportProgress() { this.getStyleClass().add("import-progress"); setAlignment(Pos.CENTER); setSpacing(35); Label lblTitle = new Label("Importing mp3s"); lblTitle.getStyleClass().add("settings-page-title"); pbImporting = new ProgressBar(); pbImporting.setProgress(0.5); pbImporting.maxWidthProperty().bind(this.widthProperty().multiply(.8)); lblPath = new Label(); lblPath.getStyleClass().add("settings-page-title2"); btnCancel = new Button("Cancel"); btnCancel.getStyleClass().add("btn-cancel"); this.getChildren().addAll(lblTitle, pbImporting, lblPath, btnCancel); }
@Override public Node drawNode() { GridPane root = new GridPane(); root.setVgap(spacing / 2); root.setHgap(spacing); double d, _d = -0.25; for (int i = 0; _d < 1; i++) { d = _d + 0.25; _d = d; ProgressBar bar = progressBarCreate(); VBox box = new VBox(); box.setAlignment(Pos.CENTER); box.getChildren().add(new Label("[" + d + "]")); bar.setProgress(d); if (bar.getProgress() != d) { reportGetterFailure("progress_indicator.getProgress()"); } box.getChildren().add(bar); root.add(box, i % 3, i / 3); } return root; }
@Test(timeout = 30000) public void progressBarCellFactoryTest() { doFactoryChange(CellType.ProgressBar); final Lookup lookup = testedControl.as(Parent.class, Node.class).lookup(new LookupCriteria() { public boolean check(Object cntrl) { if (cntrl instanceof ProgressBar) { //Some cells are created for caching purposes, ignore them. if (!((Control) cntrl).getParent().getParent().getParent().isVisible() || !((Control) cntrl).getParent().getParent().isVisible() || !((Control) cntrl).getParent().isVisible()) { return false; } return true; } return false; } }); Wrap<? extends ProgressBar> progressBar = lookup.wrap(); assertEquals("Initial value is incorrect", getProgressBarValue(progressBar), 0.5, 0.0001); changeProgressValues(0.75); assertEquals("Initial value is incorrect", getProgressBarValue(progressBar), 0.75, 0.0001); assertEquals("Amount of progress bars", lookup.size(), DATA_ITEMS_SIZE); }
@Override public void start(Stage primaryStage) throws Exception { List<Stage> benchmarkList = new ArrayList<>(); benchmarkList.add(new VectorBall(false)); benchmarkList.add(new VectorBall(true)); benchmarkList.add(new BitmapBall(false)); benchmarkList.add(new BitmapBall(true)); benchmarkList.add(new ListViewBenchmark(false)); benchmarkList.add(new ListViewBenchmark(true)); benchmarkList.add(new AreaChartBenchmark(false)); benchmarkList.add(new AreaChartBenchmark(true)); ProgressBar bar = getProgressBar(primaryStage); for (int i = 0; i < benchmarkList.size(); i++) { if (benchmarkList.size() != 0) { bar.setProgress((double) i / (double) benchmarkList.size()); } benchmarkList.get(i).showAndWait(); Thread.sleep(2000); } primaryStage.close(); }
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(); }); }
public void showConnecting() { if (connectingdialog == null) { Label l = new Label(resources.getString("message.waitingconnection")); l.setAlignment(Pos.CENTER); l.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); ProgressBar p = new ProgressBar(); p.setMaxSize(Integer.MAX_VALUE, Integer.MAX_VALUE); VBox box = new VBox(); box.setSpacing(5.0); box.setPadding(new Insets(0.0, 0.0, 50.0, 0.0)); box.getChildren().addAll(l, p); connectingdialog = new DialogView(); connectingdialog.setMaster(true); connectingdialog.setContent(box); connectingdialog.show(MessageUtils.getRoot(rootpane)); } }
@Ignore @Test public void manual() throws InterruptedException{ progressBar = new ProgressBar( 0.4 ); TestApplication.launch( () -> new BorderPane( progressBar ) ); systemUnderTest = new DynamicCssOnlyProperties(); Thread.sleep( 2000 ); systemUnderTest.applyCustomColours( Color.BLACK, Color.AQUAMARINE, progressBar ); Thread.sleep( 2000 ); systemUnderTest.applyCustomColours( Color.ORANGE, Color.SEASHELL, progressBar ); Thread.sleep( 2000 ); systemUnderTest.applyCustomColours( Color.INDIGO, Color.PEACHPUFF, progressBar ); Thread.sleep( 1000000 ); }
/** * A util method to display a blocking progress pop-up with the given parameters. * * @param progressObservable the observable object that gives us the progress * @param message the message to display while waiting * @return the stage of the opened dialog with the progress bar */ public static Stage showProgress(ProgressObservable progressObservable, String message) { Stage dialogStage = new Stage(); ProgressBar progressBar = new ProgressBar(); dialogStage.initStyle(StageStyle.DECORATED); dialogStage.setResizable(false); dialogStage.initModality(Modality.APPLICATION_MODAL); final Label label = new Label(); label.setText(message); progressBar.progressProperty().bind(progressObservable.progressProperty()); final VBox vBox = new VBox(); vBox.setAlignment(Pos.CENTER); vBox.getChildren().addAll(label, progressBar); Scene scene = new Scene(vBox); dialogStage.setScene(scene); dialogStage.toFront(); dialogStage.setOnCloseRequest(Event::consume); // prevent closing of the dialog window dialogStage.show(); return dialogStage; }
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; }
public ProgressBarDialog() { DialogPane pane = this.getDialogPane(); this.bar = new ProgressBar(); this.bar.setPrefWidth(300); this.words = new Label(); this.words.setMinWidth(50); this.words.setAlignment(Pos.BASELINE_RIGHT); this.box = new HBox(5); this.setTitle(""); // set the words on it pane.setHeaderText("Please wait."); pane.getButtonTypes().addAll(new ButtonType[] { ButtonType.CLOSE }); ((Button) pane.lookupButton(ButtonType.CLOSE)).setText("Run in background"); // you can't close it ((Button) pane.lookupButton(ButtonType.CLOSE)).setTooltip(new Tooltip("Oh, did you want a cancel button? Well, TOO BAD. Cancel buttons are hard.")); this.resetBar(); this.setResultConverter((btn) -> { // set the return value return null; }); }
@Override public void initial(ViFile observable, BaseController controller) { lock.lock(); try { progressBar = new ProgressBar(observable.infoProperty().get().computeProgress()); progressLabel = new Label(" " + observable.infoProperty().get().computeProgressPercent()); progressLabel.setAlignment(Pos.CENTER_RIGHT); // progressLabel.textProperty().bind(Bindings.convert(progressBar.progressProperty())); this.getChildren().add(progressBar); this.getChildren().add(progressLabel); progressBar.progressProperty().addListener((obser, oldvalue, newvalue) -> { Double percent = newvalue.doubleValue() * 100; progressLabel.setText(" " + percent.intValue() + "%"); }); initailized.set(true); this.setCache(true); //bind this overview pane width to the right width property in MainFrame this.progressBar.prefWidthProperty().bind( ((MainFrameController) controller).getBlockPaneWidthProperty().add(-35)); } finally { lock.unlock(); } }
private Parent createContent() { VBox root = new VBox(); root.setPrefSize(400, 600); TextField fieldURL = new TextField(); root.getChildren().addAll(fieldURL); fieldURL.setOnAction(event -> { Task<Void> task = new DownloadTask(fieldURL.getText()); ProgressBar progressBar = new ProgressBar(); progressBar.setPrefWidth(350); progressBar.progressProperty().bind(task.progressProperty()); root.getChildren().add(progressBar); fieldURL.clear(); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); }); return root; }
/** * ProgressDialog constructor. * * @throws IOException An exception occurred while getting the theme */ public ProgressDialog() throws IOException { dialogStage = new Stage(); dialogStage.initStyle(StageStyle.UTILITY); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.setTitle("Update"); mBar = new ProgressBar(); mBar.setPrefWidth(WIDTH); mBar.setProgress(-1); mMessage = new Label(""); final VBox hb = new VBox(); hb.setPadding(new Insets(5, 5, 5, 5)); hb.setSpacing(5); hb.setAlignment(Pos.CENTER_LEFT); hb.getChildren().addAll(mMessage, mBar); Scene scene = new Scene(hb); scene.getStylesheets().add(ProgressDialog.class.getResource( Theme.getProgressCss(Theme.getTheme())).toExternalForm()); dialogStage.setScene(scene); }
private void addLabels() { Label titleLabel = new Label(Res.get("dao.compensation.active.phase")); Label startLabel = new Label(Res.get("dao.compensation.active.startBlock")); AnchorPane startLabelPane = new AnchorPane(); AnchorPane.setLeftAnchor(startLabel, 0d); startLabelPane.getChildren().add(startLabel); Label endLabel = new Label(Res.get("dao.compensation.active.endBlock")); AnchorPane endLabelPane = new AnchorPane(); AnchorPane.setRightAnchor(endLabel, 0d); endLabelPane.getChildren().add(endLabel); ProgressBar progressBar = new ProgressBar(); progressBar.setMinHeight(9); progressBar.setMaxHeight(9); progressBar.setVisible(false); vBoxLabels = new VBox(); vBoxLabels.setSpacing(5); vBoxLabels.getChildren().addAll(titleLabel, progressBar, startLabelPane, endLabelPane); vBoxLabels.setAlignment(Pos.CENTER); vBoxLabels.setPadding(new Insets(0, 10, 0, 0)); getChildren().add(vBoxLabels); }
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); }
private void updateMappingItemsList(MappingSet mappingSet) { clearMappingItems(); if (mappingSet != null) { mappingItemTableView.setPlaceholder(new ProgressBar(-1.0)); Utility.execute(() -> { ObservableList<MappingItem> mappingItems = FXCollections.observableList(mappingSet.getMappingItems(activeOnlyToggle.isSelected())); Platform.runLater(() -> { mappingItemTableView.setItems(mappingItems); mappingItemTableView.setPlaceholder(new Label("The selected Mapping Set contains no Mapping Items.")); mappingItemListTitleLabel.setText(mappingSet.getName()); plusMappingItemButton.setDisable(false); minusMappingSetButton.setDisable(false); editMappingSetButton.setDisable(false); mappingSetSummaryLabel.setText(mappingSet.getSummary(activeOnlyToggle.isSelected())); }); }); } }