List of usage examples for javafx.scene.paint Color WHITE
Color WHITE
To view the source code for javafx.scene.paint Color WHITE.
Click Source Link
From source file:com.respam.comniq.Controller.java
@FXML protected void handleLocalButtonAction() { progressBar.setVisible(true);//ww w.j a va2s. c o m String exdMovies = excludeArea.getText(); excluded = new HashSet(Arrays.asList(exdMovies.split(";"))); localMovies = inputPath.getText(); File loc = new File(localMovies); if (loc.isDirectory() == false) { Text errorMsg = new Text(" Not a valid Movies Directory"); errorMsg.setFill(Color.WHITE); textFlow.getChildren().clear(); textFlow.getChildren().add(errorMsg); } if (progBarStatus == false) { progressBar.relocate(0, 100); progBarStatus = true; } if (progBarStatus == true) { progressBar.relocate(0, 100); } if (inputPath.getText().trim().isEmpty()) { Text errorMsg = new Text(" Enter a valid Movies Directory"); errorMsg.setFill(Color.WHITE); textFlow.getChildren().clear(); textFlow.getChildren().add(errorMsg); } else if (loc.isDirectory() == true && !(inputPath.getText().trim().isEmpty())) { textFlow.getChildren().clear(); parseWorker = createWorker(); progressBar.progressProperty().unbind(); progressBar.progressProperty().bind(parseWorker.progressProperty()); new Thread(parseWorker).start(); } }
From source file:com.cdd.bao.editor.endpoint.BrowseEndpoint.java
public BrowseEndpoint(Stage stage) { this.stage = stage; stage.setTitle("BioAssay Schema Browser"); treeRoot = new TreeItem<>(new Branch(this)); treeView = new TreeView<>(treeRoot); treeView.setEditable(true);/*w w w. j a v a 2 s .c o m*/ treeView.setCellFactory(p -> new BrowseTreeCell()); treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldval, newval) -> { changeValue(newval.getValue()); }); display = new DisplaySchema(); StackPane sp1 = new StackPane(), sp2 = new StackPane(); sp1.getChildren().add(treeView); sp2.getChildren().add(display); splitter = new SplitPane(); splitter.setOrientation(Orientation.HORIZONTAL); splitter.getItems().addAll(sp1, sp2); splitter.setDividerPositions(0.4, 1.0); root = new BorderPane(); root.setTop(menuBar); root.setCenter(splitter); Scene scene = new Scene(root, 700, 600, Color.WHITE); stage.setScene(scene); treeView.setShowRoot(false); rebuildTree(); Platform.runLater(() -> treeView.getFocusModel().focus(treeView.getSelectionModel().getSelectedIndex())); // for some reason it defaults to not the first item new Thread(() -> backgroundLoadTemplates()).start(); }
From source file:ijfx.ui.previewToolbar.DefaultWidget.java
@Override public Image getImage(PreviewService previewService, int size) { if (image != null) return image; if (previewService == null) return null; if (previewService.getImageDisplayService().getActiveDataset() == null) { return null; } else if (this.getIcon().equals("preview")) { try {//from w w w. ja v a 2s .c om previewService.setParameters(-1, -1, size, size); return previewService.getImageDisplay(action, this.getParameters()); } catch (Exception e) { e.printStackTrace(); FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.AMBULANCE); return FontAwesomeIconUtils.FAItoImage(fontAwesomeIconView, size); } } else if (getIcon().startsWith("char:")) { Canvas canvas = new Canvas(size, size); GraphicsContext graphicsContext2D = canvas.getGraphicsContext2D(); graphicsContext2D.setFill(Color.WHITE); graphicsContext2D.setFont(javafx.scene.text.Font.font("Arial", size)); graphicsContext2D.fillText(getIcon().substring(5), size / 3, size * 0.8); final SnapshotParameters params = new SnapshotParameters(); params.setFill(Color.TRANSPARENT); // final WritableImage snapshot = canvas.snapshot(params, null); Task<WritableImage> getIcon = new CallbackTask<Canvas, WritableImage>(canvas) .run(input -> input.snapshot(params, null)); Platform.runLater(getIcon); try { // Image image = new Ima image = getIcon.get(); return image; } catch (InterruptedException ex) { Logger.getLogger(DefaultWidget.class.getName()).log(Level.SEVERE, null, ex); } catch (ExecutionException ex) { Logger.getLogger(DefaultWidget.class.getName()).log(Level.SEVERE, null, ex); } return null; } //Check if icon exist in Enumeration else if (Arrays.stream(FontAwesomeIcon.values()).filter(e -> e.name().equals(icon)).count() > 0) { FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.valueOf(icon)); return FontAwesomeIconUtils.FAItoImage(fontAwesomeIconView, size); } else { image = new Image(getClass().getResource(icon).toExternalForm(), size, size, true, true); return image; } }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 500, 250, Color.WHITE); GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);/*from w w w. j a va 2 s . com*/ gridpane.setVgap(10); root.setCenter(gridpane); ObservableList<Person> leaders = getPeople(); final ObservableList<Person> teamMembers = FXCollections.observableArrayList(); ListView<Person> leaderListView = createLeaderListView(leaders); TableView<Person> employeeTableView = createEmployeeTableView(teamMembers); Label bossesLbl = new Label("Boss"); GridPane.setHalignment(bossesLbl, HPos.CENTER); gridpane.add(bossesLbl, 0, 0); gridpane.add(leaderListView, 0, 1); Label emplLbl = new Label("Employees"); GridPane.setHalignment(emplLbl, HPos.CENTER); gridpane.add(emplLbl, 2, 0); gridpane.add(employeeTableView, 2, 1); leaderListView.getSelectionModel().selectedItemProperty() .addListener((ObservableValue<? extends Person> observable, Person oldValue, Person newValue) -> { if (observable != null && observable.getValue() != null) { teamMembers.clear(); teamMembers.addAll(observable.getValue().employeesProperty()); } }); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = SceneBuilder.create().width(320).height(343) .root(GroupBuilder.create()/* w ww . jav a 2s . c o m*/ .children( RectangleBuilder.create().width(320).height(45) .fill(LinearGradientBuilder.create().endX(0.0).endY(1.0) .stops(new Stop(0, Color.web("0xAEBBCC")), new Stop(1, Color.web("0x6D84A3"))) .build()) .build(), TextBuilder .create().layoutX(65).layoutY(12).textOrigin(VPos.TOP).fill(Color.WHITE) .text("Audio Configuration") .font(Font.font("SansSerif", FontWeight.BOLD, 20)).build(), RectangleBuilder .create().x(0).y(43).width(320).height(300).fill(Color.rgb(199, 206, 213)) .build(), RectangleBuilder .create().x(9).y(54).width(300).height(130).arcWidth(20).arcHeight(20) .fill(Color.WHITE).stroke(Color.color(0.66, 0.67, 0.69)).build(), textDb = TextBuilder.create().layoutX(18).layoutY(69).textOrigin(VPos.TOP) .fill(Color.web("#131021")) .font(Font.font("SansSerif", FontWeight.BOLD, 18)).build(), slider = SliderBuilder.create().layoutX(135).layoutY(69).prefWidth(162) .min(acModel.minDecibels).max(acModel.maxDecibels).build(), LineBuilder .create().startX(9).startY(97).endX(309).endY(97) .stroke(Color.color(0.66, 0.67, 0.69)).build(), TextBuilder.create().layoutX(18).layoutY(113).textOrigin(VPos.TOP) .fill(Color.web("#131021")).text("Muting") .font(Font.font("SanSerif", FontWeight.BOLD, 18)).build(), mutingCheckBox = CheckBoxBuilder.create().layoutX(280).layoutY(113).build(), LineBuilder.create().startX(9).startY(141).endX(309).endY(141) .stroke(Color.color(0.66, 0.67, 0.69)).build(), TextBuilder.create().layoutX(18).layoutY(154).textOrigin(VPos.TOP) .fill(Color.web("#131021")).text("Genre") .font(Font.font("SanSerif", FontWeight.BOLD, 18)).build(), genreChoiceBox = ChoiceBoxBuilder.create().layoutX(204).layoutY(154).prefWidth(93) .items(acModel.genres).build()) .build()) .build(); textDb.textProperty().bind(acModel.selectedDBs.asString().concat(" dB")); slider.valueProperty().bindBidirectional(acModel.selectedDBs); slider.disableProperty().bind(acModel.muting); mutingCheckBox.selectedProperty().bindBidirectional(acModel.muting); acModel.genreSelectionModel = genreChoiceBox.getSelectionModel(); acModel.addListenerToGenreSelectionModel(); acModel.genreSelectionModel.selectFirst(); stage.setScene(scene); stage.setTitle("Audio Configuration"); stage.show(); }
From source file:nl.rivm.cib.episim.model.disease.infection.MSEIRSPlot.java
@Override public void start(final Stage stage) { final SIRConfig conf = ConfigFactory.create(SIRConfig.class); final double[] t = conf.t(); final long[] pop = conf.population(); final double n0 = Arrays.stream(pop).sum(); final String[] colors = conf.colors(), colors2 = conf.colors2(); final Pane plot = new Pane(); plot.setPrefSize(400, 300);/*from w ww. ja v a2 s. c o m*/ plot.setMinSize(50, 50); final NumberAxis xAxis = new NumberAxis(t[0], t[1], (t[1] - t[0]) / 10); final NumberAxis yAxis = new NumberAxis(0, n0, n0 / 10); final Pane axes = new Pane(); axes.prefHeightProperty().bind(plot.heightProperty()); axes.prefWidthProperty().bind(plot.widthProperty()); xAxis.setSide(Side.BOTTOM); xAxis.setMinorTickVisible(false); xAxis.setPrefWidth(axes.getPrefWidth()); xAxis.prefWidthProperty().bind(axes.widthProperty()); xAxis.layoutYProperty().bind(axes.heightProperty()); yAxis.setSide(Side.LEFT); yAxis.setMinorTickVisible(false); yAxis.setPrefHeight(axes.getPrefHeight()); yAxis.prefHeightProperty().bind(axes.heightProperty()); yAxis.layoutXProperty().bind(Bindings.subtract(1, yAxis.widthProperty())); axes.getChildren().setAll(xAxis, yAxis); final Label lbl = new Label(String.format("R0=%.1f, recovery=%.1ft\nSIR(0)=%s", conf.reproduction(), conf.recovery(), Arrays.toString(pop))); lbl.setTextAlignment(TextAlignment.CENTER); lbl.setTextFill(Color.WHITE); final Path[] deterministic = { new Path(), new Path(), new Path() }; IntStream.range(0, pop.length).forEach(i -> { final Color color = Color.valueOf(colors[i]); final Path path = deterministic[i]; path.setStroke(color.deriveColor(0, 1, 1, 0.6)); path.setStrokeWidth(2); path.setClip(new Rectangle(0, 0, plot.getPrefWidth(), plot.getPrefHeight())); }); plot.getChildren().setAll(axes); // fill paths with integration estimates final double xl = xAxis.getLowerBound(), sx = plot.getPrefWidth() / (xAxis.getUpperBound() - xl), yh = plot.getPrefHeight(), sy = yh / (yAxis.getUpperBound() - yAxis.getLowerBound()); final TreeMap<Double, Integer> iDeterministic = new TreeMap<>(); MSEIRSTest.deterministic(conf, () -> new DormandPrince853Integrator(1.0E-8, 10, 1.0E-20, 1.0E-20)) .subscribe(yt -> { iDeterministic.put(yt.getKey(), deterministic[0].getElements().size()); final double[] y = yt.getValue(); final double x = (yt.getKey() - xl) * sx; for (int i = 0; i < y.length; i++) { final double yi = yh - y[i] * sy; final PathElement di = deterministic[i].getElements().isEmpty() ? new MoveTo(x, yi) : new LineTo(x, yi); deterministic[i].getElements().add(di); } }, e -> LOG.error("Problem", e), () -> plot.getChildren().addAll(deterministic)); final Path[] stochasticTau = { new Path(), new Path(), new Path() }; IntStream.range(0, pop.length).forEach(i -> { final Color color = Color.valueOf(colors[i]); final Path path = stochasticTau[i]; path.setStroke(color); path.setStrokeWidth(1); path.setClip(new Rectangle(0, 0, plot.getPrefWidth(), plot.getPrefHeight())); }); final TreeMap<Double, Integer> iStochasticTau = new TreeMap<>(); MSEIRSTest.stochasticGillespie(conf).subscribe(yt -> { final double x = (yt.getKey() - xl) * sx; iStochasticTau.put(yt.getKey(), stochasticTau[0].getElements().size()); final long[] y = yt.getValue(); for (int i = 0; i < y.length; i++) { final double yi = yh - y[i] * sy; final ObservableList<PathElement> path = stochasticTau[i].getElements(); if (path.isEmpty()) { path.add(new MoveTo(x, yi)); // first } else { final PathElement last = path.get(path.size() - 1); final double y_prev = last instanceof MoveTo ? ((MoveTo) last).getY() : ((LineTo) last).getY(); path.add(new LineTo(x, y_prev)); path.add(new LineTo(x, yi)); } } }, e -> LOG.error("Problem", e), () -> plot.getChildren().addAll(stochasticTau)); final Path[] stochasticRes = { new Path(), new Path(), new Path() }; IntStream.range(0, pop.length).forEach(i -> { final Color color = Color.valueOf(colors2[i]); final Path path = stochasticRes[i]; path.setStroke(color); path.setStrokeWidth(1); path.setClip(new Rectangle(0, 0, plot.getPrefWidth(), plot.getPrefHeight())); }); final TreeMap<Double, Integer> iStochasticRes = new TreeMap<>(); MSEIRSTest.stochasticSellke(conf).subscribe(yt -> { final double x = (yt.getKey() - xl) * sx; iStochasticRes.put(yt.getKey(), stochasticRes[0].getElements().size()); final long[] y = yt.getValue(); for (int i = 0; i < y.length; i++) { final double yi = yh - y[i] * sy; final ObservableList<PathElement> path = stochasticRes[i].getElements(); if (path.isEmpty()) { path.add(new MoveTo(x, yi)); // first } else { final PathElement last = path.get(path.size() - 1); final double y_prev = last instanceof MoveTo ? ((MoveTo) last).getY() : ((LineTo) last).getY(); path.add(new LineTo(x, y_prev)); path.add(new LineTo(x, yi)); } } }, e -> LOG.error("Problem", e), () -> plot.getChildren().addAll(stochasticRes)); // auto-scale on stage/plot resize // FIXME scaling around wrong origin, use ScatterChart? // xAxis.widthProperty() // .addListener( (ChangeListener<Number>) ( observable, // oldValue, newValue ) -> // { // final double scale = ((Double) newValue) // / plot.getPrefWidth(); // plot.getChildren().filtered( n -> n instanceof Path ) // .forEach( n -> // { // final Path path = (Path) n; // path.setScaleX( scale ); // path.setTranslateX( (path // .getBoundsInParent().getWidth() // - path.getLayoutBounds().getWidth()) // / 2 ); // } ); // } ); // plot.heightProperty() // .addListener( (ChangeListener<Number>) ( observable, // oldValue, newValue ) -> // { // final double scale = ((Double) newValue) // / plot.getPrefHeight(); // plot.getChildren().filtered( n -> n instanceof Path ) // .forEach( n -> // { // final Path path = (Path) n; // path.setScaleY( scale ); // path.setTranslateY( // (path.getBoundsInParent() // .getHeight() * (scale - 1)) // / 2 ); // } ); // } ); final StackPane layout = new StackPane(lbl, plot); layout.setAlignment(Pos.TOP_CENTER); layout.setPadding(new Insets(50)); layout.setStyle("-fx-background-color: rgb(35, 39, 50);"); final Line vertiCross = new Line(); vertiCross.setStroke(Color.SILVER); vertiCross.setStrokeWidth(1); vertiCross.setVisible(false); axes.getChildren().add(vertiCross); final Tooltip tip = new Tooltip(""); tip.setAutoHide(false); tip.hide(); axes.setOnMouseExited(ev -> tip.hide()); axes.setOnMouseMoved(ev -> { final Double x = (Double) xAxis.getValueForDisplay(ev.getX()); if (x > xAxis.getUpperBound() || x < xAxis.getLowerBound()) { tip.hide(); vertiCross.setVisible(false); return; } final Double y = (Double) yAxis.getValueForDisplay(ev.getY()); if (y > yAxis.getUpperBound() || y < yAxis.getLowerBound()) { tip.hide(); vertiCross.setVisible(false); return; } final double xs = xAxis.getDisplayPosition(x); vertiCross.setStartX(xs); vertiCross.setStartY(yAxis.getDisplayPosition(0)); vertiCross.setEndX(xs); vertiCross.setEndY(yAxis.getDisplayPosition(yAxis.getUpperBound())); vertiCross.setVisible(true); final int i = (iDeterministic.firstKey() > x ? iDeterministic.firstEntry() : iDeterministic.floorEntry(x)).getValue(); final Object[] yi = Arrays.stream(deterministic).mapToDouble(p -> getY(p, i)) .mapToObj(yAxis::getValueForDisplay).map(n -> DecimalUtil.toScale(n, 1)).toArray(); final int j = (iStochasticTau.firstKey() > x ? iStochasticTau.firstEntry() : iStochasticTau.floorEntry(x)).getValue(); final Object[] yj = Arrays.stream(stochasticTau).mapToDouble(p -> getY(p, j)) .mapToObj(yAxis::getValueForDisplay).map(n -> DecimalUtil.toScale(n, 0)).toArray(); final int k = (iStochasticRes.firstKey() > x ? iStochasticRes.firstEntry() : iStochasticRes.floorEntry(x)).getValue(); final Object[] yk = Arrays.stream(stochasticRes).mapToDouble(p -> getY(p, k)) .mapToObj(yAxis::getValueForDisplay).map(n -> DecimalUtil.toScale(n, 0)).toArray(); final String txt = String.format("SIR(t=%.1f)\n" + "~det%s\n" + "~tau%s\n" + "~res%s", x, Arrays.toString(yi), Arrays.toString(yj), Arrays.toString(yk)); tip.setText(txt); tip.show(axes, ev.getScreenX() - ev.getSceneX() + xs, ev.getScreenY() + 15); }); try { stage.getIcons().add(new Image(FileUtil.toInputStream("icon.jpg"))); } catch (final IOException e) { LOG.error("Problem", e); } stage.setTitle("Deterministic vs. Stochastic"); stage.setScene(new Scene(layout, Color.rgb(35, 39, 50))); // stage.setOnHidden( ev -> tip.hide() ); stage.show(); }
From source file:User.java
private HBox drawRow2() { PasswordField passwordField = new PasswordField(); passwordField.setFont(Font.font("SanSerif", 20)); passwordField.setPromptText("Password"); passwordField.setStyle(// w ww. j a v a2s. c o m "-fx-text-fill:black; " + "-fx-prompt-text-fill:gray; " + "-fx-highlight-text-fill:black; " + "-fx-highlight-fill: gray; " + "-fx-background-color: rgba(255, 255, 255, .80); "); passwordField.prefWidthProperty().bind(primaryStage.widthProperty().subtract(55)); user.passwordProperty().bind(passwordField.textProperty()); // error icon SVGPath deniedIcon = new SVGPath(); deniedIcon.setFill(Color.rgb(255, 0, 0, .9)); deniedIcon.setStroke(Color.WHITE);// deniedIcon.setContent("M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 " + "16.447,13.08710.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10" + ".946,24.248 16.447,18.746 21.948,24.248z"); deniedIcon.setVisible(false); SVGPath grantedIcon = new SVGPath(); grantedIcon.setFill(Color.rgb(0, 255, 0, .9)); grantedIcon.setStroke(Color.WHITE);// grantedIcon.setContent( "M2.379,14.729 5.208,11.899 12.958,19.648 25.877," + "6.733 28.707,9.56112.958,25.308z"); grantedIcon.setVisible(false); // StackPane accessIndicator = new StackPane(); accessIndicator.getChildren().addAll(deniedIcon, grantedIcon); accessIndicator.setAlignment(Pos.CENTER_RIGHT); grantedIcon.visibleProperty().bind(GRANTED_ACCESS); // user hits the enter key passwordField.setOnAction(actionEvent -> { if (GRANTED_ACCESS.get()) { System.out.printf("User %s is granted access.\n", user.getUserName()); System.out.printf("User %s entered the password: %s\n", user.getUserName(), user.getPassword()); Platform.exit(); } else { deniedIcon.setVisible(true); } ATTEMPTS.set(ATTEMPTS.add(1).get()); System.out.println("Attempts: " + ATTEMPTS.get()); }); // listener when the user types into the password field passwordField.textProperty().addListener((obs, ov, nv) -> { boolean granted = passwordField.getText().equals(MY_PASS); GRANTED_ACCESS.set(granted); if (granted) { deniedIcon.setVisible(false); } }); // listener on number of attempts ATTEMPTS.addListener((obs, ov, nv) -> { if (MAX_ATTEMPTS == nv.intValue()) { // failed attempts System.out.printf("User %s is denied access.\n", user.getUserName()); Platform.exit(); } }); // second row HBox row2 = new HBox(3); row2.getChildren().addAll(passwordField, accessIndicator); return row2; }
From source file:de.pixida.logtest.designer.automaton.RectangularNode.java
RectangularNode(final Graph graph, final ContentDisplayMode aContentDisplayMode, final int zIndex) { super(graph); Validate.notNull(aContentDisplayMode); this.contentDisplayMode = aContentDisplayMode; this.rectangle.setStroke(BORDER_COLOR_DEFAULT); final Font titleFont = Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 10.0); this.titleText.setFont(titleFont); final Font contentFont = Font.font(titleFont.getFamily(), FontWeight.NORMAL, titleFont.getSize()); this.contentText.setFont(contentFont); this.textFlow.getChildren().addAll(this.titleText, this.separatorText, this.contentText); this.textFlow.layoutXProperty().bind(this.rectangle.xProperty()); this.textFlow.layoutYProperty().bind(this.rectangle.yProperty()); final double insetTop = 0.0; final double insetRight = 3.0; final double insetBottom = 3.0; final double insetLeft = 3.0; this.textFlow.setPadding(new Insets(insetTop, insetRight, insetBottom, insetLeft)); this.textFlow.setMouseTransparent(true); this.contentDisplayMode.init(this.textFlow, this.rectangle); if (this.contentDisplayMode.isResizable()) { // this.createResizeSpots(); }/*from w ww. j a va 2s . c o m*/ this.registerPart(this.rectangle, zIndex); this.registerPart(this.textFlow, zIndex); this.registerActionHandler(this.rectangle); this.loadDimensionsFromJson(new JSONObject()); this.setColor(Color.WHITE); this.setContent(null); }
From source file:com.cdd.bao.editor.EditSchema.java
public EditSchema(Stage stage) { this.stage = stage; if (MainApplication.icon != null) stage.getIcons().add(MainApplication.icon); menuBar = new MenuBar(); menuBar.setUseSystemMenuBar(true);//w w w . ja v a 2s . co m menuBar.getMenus().add(menuFile = new Menu("_File")); menuBar.getMenus().add(menuEdit = new Menu("_Edit")); menuBar.getMenus().add(menuValue = new Menu("_Value")); menuBar.getMenus().add(menuView = new Menu("Vie_w")); createMenuItems(); treeRoot = new TreeItem<>(new Branch(this)); treeView = new TreeView<>(treeRoot); treeView.setEditable(true); treeView.setCellFactory(p -> new HierarchyTreeCell()); treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldVal, newVal) -> { if (oldVal != null) pullDetail(oldVal); if (newVal != null) pushDetail(newVal); }); treeView.focusedProperty() .addListener((val, oldValue, newValue) -> Platform.runLater(() -> maybeUpdateTree())); detail = new DetailPane(this); StackPane sp1 = new StackPane(), sp2 = new StackPane(); sp1.getChildren().add(treeView); sp2.getChildren().add(detail); splitter = new SplitPane(); splitter.setOrientation(Orientation.HORIZONTAL); splitter.getItems().addAll(sp1, sp2); splitter.setDividerPositions(0.4, 1.0); progBar = new ProgressBar(); progBar.setMaxWidth(Double.MAX_VALUE); root = new BorderPane(); root.setTop(menuBar); root.setCenter(splitter); root.setBottom(progBar); BorderPane.setMargin(progBar, new Insets(2, 2, 2, 2)); Scene scene = new Scene(root, 1000, 800, Color.WHITE); stage.setScene(scene); treeView.setShowRoot(false); treeRoot.getChildren().add(treeTemplate = new TreeItem<>(new Branch(this, "Template"))); treeRoot.getChildren().add(treeAssays = new TreeItem<>(new Branch(this, "Assays"))); treeTemplate.setExpanded(true); treeAssays.setExpanded(true); rebuildTree(); Platform.runLater(() -> treeView.getFocusModel().focus(treeView.getSelectionModel().getSelectedIndex())); // for some reason it defaults to not the first item stage.setOnCloseRequest(event -> { if (!confirmClose()) event.consume(); }); updateTitle(); // loading begins in a background thread, and is updated with a status bar Vocabulary.Listener listener = new Vocabulary.Listener() { public void vocabLoadingProgress(Vocabulary vocab, float progress) { Platform.runLater(() -> { progBar.setProgress(progress); if (vocab.isLoaded()) root.getChildren().remove(progBar); }); } public void vocabLoadingException(Exception ex) { ex.printStackTrace(); } }; Vocabulary.globalInstance(listener); }
From source file:Main.java
private void addStackPane(HBox hb) { StackPane stack = new StackPane(); Rectangle helpIcon = new Rectangle(30.0, 25.0); helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")), new Stop(1, Color.web("#9CB6CF")), })); helpIcon.setStroke(Color.web("#D0E6FA")); helpIcon.setArcHeight(3.5);//from w w w .ja v a 2s. c om helpIcon.setArcWidth(3.5); Text helpText = new Text("?"); helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); helpText.setFill(Color.WHITE); helpText.setStroke(Color.web("#7080A0")); stack.getChildren().addAll(helpIcon, helpText); stack.setAlignment(Pos.CENTER_RIGHT); // Add offset to right for question mark to compensate for RIGHT // alignment of all nodes StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); hb.getChildren().add(stack); HBox.setHgrow(stack, Priority.ALWAYS); }