Java Code Examples for javafx.scene.layout.GridPane#setBackground()
The following examples show how to use
javafx.scene.layout.GridPane#setBackground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpectralMatchPanelFX.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
private GridPane createTitlePane() { pnTitle = new GridPane(); pnTitle.setAlignment(Pos.CENTER); // create Top panel double simScore = hit.getSimilarity().getScore(); Color gradientCol = FxColorUtil.awtColorToFX(ColorScaleUtil .getColor(FxColorUtil.fxColorToAWT(MIN_COS_COLOR), FxColorUtil.fxColorToAWT(MAX_COS_COLOR), MIN_COS_COLOR_VALUE, MAX_COS_COLOR_VALUE, simScore)); pnTitle.setBackground( new Background(new BackgroundFill(gradientCol, CornerRadii.EMPTY, Insets.EMPTY))); lblHit = new Label(hit.getName()); lblHit.getStyleClass().add("white-larger-label"); lblScore = new Label(COS_FORM.format(simScore)); lblScore.getStyleClass().add("white-score-label"); lblScore .setTooltip(new Tooltip("Cosine similarity of raw data scan (top, blue) and database scan: " + COS_FORM.format(simScore))); pnTitle.add(lblHit, 0, 0); pnTitle.add(lblScore, 1, 0); ColumnConstraints ccTitle0 = new ColumnConstraints(150, -1, -1, Priority.ALWAYS, HPos.LEFT, true); ColumnConstraints ccTitle1 = new ColumnConstraints(150, 150, 150, Priority.NEVER, HPos.LEFT, false); pnTitle.getColumnConstraints().add(0, ccTitle0); pnTitle.getColumnConstraints().add(1, ccTitle1); return pnTitle; }
Example 2
Source File: ActivityDashboard.java From medusademo with Apache License 2.0 | 5 votes |
@Override public void init() { GaugeBuilder builder = GaugeBuilder.create() .skinType(SkinType.SLIM) .barBackgroundColor(MaterialDesign.GREY_800.get()) .animated(true) .animationDuration(1000); steps = builder.decimals(0).maxValue(10000).unit("STEPS").build(); distance = builder.decimals(2).maxValue(10).unit("KM").build(); actvCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build(); foodCalories = builder.decimals(0).maxValue(2200).unit("KCAL").build(); weight = builder.decimals(1).maxValue(85).unit("KG").build(); bodyFat = builder.decimals(1).maxValue(20).unit("%").build(); VBox stepsBox = getVBox("STEPS", MaterialDesign.CYAN_300.get(), steps); VBox distanceBox = getVBox("DISTANCE", MaterialDesign.ORANGE_300.get(), distance); VBox actvCaloriesBox = getVBox("ACTIVE CALORIES", MaterialDesign.RED_300.get(), actvCalories); VBox foodCaloriesBox = getVBox("FOOD", MaterialDesign.GREEN_300.get(), foodCalories); VBox weightBox = getVBox("WEIGHT", MaterialDesign.DEEP_PURPLE_300.get(), weight); VBox bodyFatBox = getVBox("BODY FAT", MaterialDesign.PURPLE_300.get(), bodyFat); pane = new GridPane(); pane.setPadding(new Insets(20)); pane.setHgap(10); pane.setVgap(15); pane.setBackground(new Background(new BackgroundFill(MaterialDesign.GREY_900.get(), CornerRadii.EMPTY, Insets.EMPTY))); pane.add(stepsBox, 0, 0); pane.add(distanceBox, 1, 0); pane.add(actvCaloriesBox, 0, 2); pane.add(foodCaloriesBox, 1, 2); pane.add(weightBox, 0, 4); pane.add(bodyFatBox, 1, 4); }
Example 3
Source File: GetPassByMail.java From SmartCity-ParkingManagement with Apache License 2.0 | 4 votes |
public void display(final Stage primaryStage, final WindowEnum prevWindow) { window = primaryStage; window.setTitle("Get Password By Email"); // window.initModality(Modality.APPLICATION_MODAL); final GridPane grid = new GridPane(); grid.setPadding(new Insets(20, 20, 20, 20)); grid.setVgap(8); grid.setHgap(10); grid.setBackground( new Background(new BackgroundFill(Color.LIGHTBLUE, CornerRadii.EMPTY, new Insets(2, 2, 2, 2)))); window.setWidth(550); window.setHeight(180); final Label instruction = new Label("Please enter your eMail address in order to get your password"); GridPane.setConstraints(instruction, 0, 0); final TextField eMailInput = new TextField(); final String defaultMail = "[email protected]"; eMailInput.setText(defaultMail); GridPane.setConstraints(eMailInput, 0, 1); final Button sendButton = new Button(); sendButton.setText("Send Mail"); sendButton.setOnAction(e -> { if (eMailInput.getText().equals(defaultMail)) new AlertBox().display("Bad Input", "The mail you entered is the default! " + "\nPlease try again."); else if (!isValidMailAddress(eMailInput)) new AlertBox().display("Bad Input", "Illegal address entered! " + "\nPlease try again."); else { try { sendPassword(eMailInput); } catch (final Exception eMailException) { System.out.println(e); } window.close(); AbstractWindow.prevWindows.get(AbstractWindow.prevWindows.size() - 1).window.show(); AbstractWindow.prevWindows.remove(AbstractWindow.prevWindows.size() - 1); new AlertBox().display("Password Sent", "The password was sent to your eMail account"); } }); GridPane.setConstraints(sendButton, 0, 2); final Button backButton = new Button(); backButton.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("back_button.png")))); backButton.getStyleClass().add("button-go"); backButton.setOnAction(λ -> { window.close(); handleBack(); }); GridPane.setConstraints(backButton, 1, 2); grid.getChildren().addAll(instruction, eMailInput, sendButton, backButton); final Scene scene = new Scene(grid, 420, 150); scene.getStylesheets().add(getClass().getResource("mainStyle.css").toExternalForm()); window.setScene(scene); window.show(); }
Example 4
Source File: OverviewDemo.java From medusademo with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { GridPane pane = new GridPane(); pane.add(framedGauge1, 0, 0); pane.add(framedGauge2, 1, 0); pane.add(gauge3, 2, 0); pane.add(gauge4, 3, 0); pane.add(gauge5, 4, 0); pane.add(clock1, 5, 0); pane.add(clock5, 6, 0); pane.add(gauge22, 7, 0); pane.add(gauge29, 8, 0); pane.add(gauge6, 0, 1); pane.add(gauge7, 1, 1); pane.add(gauge8, 2, 1); pane.add(gauge9, 3, 1); pane.add(gauge10, 4, 1); pane.add(clock2, 5, 1); pane.add(gauge21, 6, 1); pane.add(gauge23, 7, 1); pane.add(gauge30, 8, 1); pane.add(gauge11, 0, 2); pane.add(gauge12, 1, 2); pane.add(gauge13, 2, 2); pane.add(gauge14, 3, 2); pane.add(gauge15, 4, 2); pane.add(clock3, 5, 2); pane.add(clock6, 6, 2); pane.add(clock8, 7, 2); pane.add(gauge31, 8, 2); pane.add(gauge16, 0, 3); pane.add(gauge17, 1, 3); pane.add(gauge18, 2, 3); pane.add(gauge19, 3, 3); pane.add(gauge20, 4, 3); pane.add(clock4, 5, 3); pane.add(clock7, 6, 3); pane.add(gauge24, 7, 3); pane.add(clock12, 8, 3); pane.add(gauge25, 0, 4); pane.add(gauge26, 1, 4); pane.add(gauge27, 2, 4); pane.add(gauge28, 4, 4); pane.add(clock9, 5, 4); pane.add(clock10, 6, 4); pane.add(clock11, 7, 4); pane.setHgap(10); pane.setVgap(10); pane.setPadding(new Insets(10)); for (int i = 0 ; i < 9 ; i++) { pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE)); } for (int i = 0 ; i < 5 ; i++) { pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE)); } pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY))); Scene scene = new Scene(pane); stage.setTitle("Medusa Gauges and Clocks"); stage.setScene(scene); stage.show(); timer.start(); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }
Example 5
Source File: Demo.java From Medusa with Apache License 2.0 | 4 votes |
@Override public void start(Stage stage) { GridPane pane = new GridPane(); pane.add(gauge1, 0, 0); pane.add(gauge2, 1, 0); pane.add(gauge3, 2, 0); pane.add(gauge4, 3, 0); pane.add(gauge5, 4, 0); pane.add(clock1, 5, 0); pane.add(clock5, 6, 0); pane.add(gauge22, 7, 0); pane.add(gauge29, 8, 0); pane.add(gauge6, 0, 1); pane.add(gauge7, 1, 1); pane.add(gauge8, 2, 1); pane.add(gauge9, 3, 1); pane.add(gauge10, 4, 1); pane.add(clock2, 5, 1); pane.add(gauge21, 6, 1); pane.add(gauge23, 7, 1); pane.add(gauge30, 8, 1); pane.add(gauge11, 0, 2); pane.add(gauge12, 1, 2); pane.add(gauge13, 2, 2); pane.add(gauge14, 3, 2); pane.add(gauge15, 4, 2); pane.add(clock3, 5, 2); pane.add(clock6, 6, 2); pane.add(clock8, 7, 2); pane.add(gauge31, 8, 2); pane.add(gauge16, 0, 3); pane.add(gauge17, 1, 3); pane.add(gauge18, 2, 3); pane.add(gauge19, 3, 3); pane.add(gauge20, 4, 3); pane.add(clock4, 5, 3); pane.add(clock7, 6, 3); pane.add(gauge24, 7, 3); pane.add(clock12, 8, 3); pane.add(gauge25, 0, 4); pane.add(gauge26, 1, 4); pane.add(gauge27, 2, 4); pane.add(gauge28, 4, 4); pane.add(clock9, 5, 4); pane.add(clock10, 6, 4); pane.add(clock11, 7, 4); pane.setHgap(10); pane.setVgap(10); pane.setPadding(new Insets(10)); for (int i = 0 ; i < 9 ; i++) { pane.getColumnConstraints().add(new ColumnConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE)); } for (int i = 0 ; i < 5 ; i++) { pane.getRowConstraints().add(new RowConstraints(MIN_CELL_SIZE, PREF_CELL_SIZE, MAX_CELL_SIZE)); } pane.setBackground(new Background(new BackgroundFill(Color.rgb(90, 90, 90), CornerRadii.EMPTY, Insets.EMPTY))); Scene scene = new Scene(pane); stage.setTitle("Medusa Gauges and Clocks"); stage.setScene(scene); stage.show(); timer.start(); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }