Java Code Examples for javafx.scene.layout.VBox#setStyle()
The following examples show how to use
javafx.scene.layout.VBox#setStyle() .
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: FxlDemo.java From fxldemo-gradle with Apache License 2.0 | 7 votes |
public void start(Stage stage) throws Exception { stage.setTitle("Hello World"); stage.initStyle(StageStyle.UNDECORATED); Label label = new Label(stage.getTitle()); label.setStyle("-fx-font-size: 25"); // Alibi for including ControlsFX Dependency :) SegmentedButton fxcontrol = new SegmentedButton(new ToggleButton("One"), new ToggleButton("Two"), new ToggleButton("Three")); Button exitButton = new Button("Exit"); exitButton.setStyle("-fx-font-weight: bold"); exitButton.setOnAction(event -> Platform.exit()); VBox root = new VBox(label, fxcontrol, exitButton); root.setAlignment(Pos.CENTER); root.setSpacing(20); root.setPadding(new Insets(25)); root.setStyle("-fx-border-color: lightblue"); stage.setScene(new Scene(root)); stage.show(); }
Example 2
Source File: MultipleMainPane.java From oim-fx with MIT License | 6 votes |
private void initComponent() { multipleListPane.setPrefWidth(228); multipleListPane.setPrefHeight(600); VBox lineVBox = new VBox(); lineVBox.setMinWidth(1); lineVBox.setStyle("-fx-background-color:#000000;"); BorderPane lineBorderPane = new BorderPane(); lineBorderPane.setLeft(multipleListPane); lineBorderPane.setRight(lineVBox); rootBorderPane.setLeft(lineBorderPane); this.getChildren().add(rootBorderPane); }
Example 3
Source File: WebFrame.java From oim-fx with MIT License | 5 votes |
private void initComponent() { this.setTitle(""); this.setMinWidth(320); this.setMinHeight(240); this.setWidth(800); this.setHeight(480); VBox rootBox = new VBox(); this.setCenter(rootBox); rootBox.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)"); rootBox.getChildren().add(webView); }
Example 4
Source File: MultipleListPane.java From oim-fx with MIT License | 5 votes |
private void initComponent() { StackPane logoStackPane = new StackPane(); logoStackPane.setPadding(new Insets(20, 0, 0, 0)); logoStackPane.getChildren().add(logoImageView); HBox lineHBox = new HBox(); lineHBox.setMinHeight(1); lineHBox.setStyle("-fx-background-color:#ed3a3a;"); textLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1);-fx-font-size: 16px;"); HBox textLabelHBox = new HBox(); textLabelHBox.setAlignment(Pos.CENTER); textLabelHBox.getChildren().add(textLabel); loginButton.setText("登录微信"); loginButton.setPrefSize(220, 35); HBox loginButtonHBox = new HBox(); loginButtonHBox.setPadding(new Insets(0, 4, 10, 4)); loginButtonHBox.setAlignment(Pos.CENTER); loginButtonHBox.getChildren().add(loginButton); VBox vBox = new VBox(); vBox.setSpacing(20); vBox.setStyle("-fx-background-color:#26292e;"); vBox.getChildren().add(logoStackPane); vBox.getChildren().add(lineHBox); vBox.getChildren().add(textLabelHBox); vBox.getChildren().add(loginButtonHBox); this.setTop(vBox); this.setCenter(listRooPane); this.setStyle("-fx-background-color:#2e3238;"); }
Example 5
Source File: Exercise_16_08.java From Intro-to-Java-Programming with MIT License | 5 votes |
/** Return a table */ protected VBox getTable( TextField centerX, TextField centerY, TextField r, int n) { VBox vBox = new VBox(2); vBox.setStyle("-fx-border-color: Black"); vBox.getChildren().addAll(new Label("Enter circle " + n + " info:"), getGrid(centerX, centerY, r)); return vBox; }
Example 6
Source File: DefaultUIProvider.java From fxlauncher with Apache License 2.0 | 5 votes |
public Parent createUpdater(FXManifest manifest) { progressBar = new ProgressBar(); progressBar.setStyle(manifest.progressBarStyle); Label label = new Label(manifest.updateText); label.setStyle(manifest.updateLabelStyle); VBox wrapper = new VBox(label, progressBar); wrapper.setStyle(manifest.wrapperStyle); return wrapper; }
Example 7
Source File: DateTimeRangeInputPane.java From constellation with Apache License 2.0 | 5 votes |
/** * Build a single datetime picker. * * @param label * @param ld * @param h * @param m * @param s * @param listener * @return */ private Pane createPicker(final String label, final ChangeListener<String> changed) { final Label dpLabel = new Label(label); final DatePicker dp = new DatePicker(); dp.setConverter(new StringConverter<LocalDate>() { @Override public String toString(final LocalDate date) { return date != null ? DATE_FORMATTER.format(date) : ""; } @Override public LocalDate fromString(final String s) { return s != null && !s.isEmpty() ? LocalDate.parse(s, DATE_FORMATTER) : null; } }); dpLabel.setLabelFor(dp); final HBox dpBox = new HBox(dpLabel, dp); final HBox spinnerBox = new HBox(CONTROLPANE_SPACING / 2); dp.maxWidthProperty().bind(spinnerBox.widthProperty().multiply(2.0 / 3.0)); spinnerBox.getChildren().addAll(createSpinner("Hour", 0, 23, changed), createSpinner("Minute", 0, 59, changed), createSpinner("Second", 0, 59, changed)); final VBox picker = new VBox(dpBox, spinnerBox); picker.setStyle("-fx-padding:4; -fx-border-radius:4; -fx-border-color: grey;"); dp.getEditor().textProperty().addListener(changed); // The DatePicker has the horrible problem that you can type in the text field, but the value won't change, // so if you type a new date and click Go, the old date will be used, not the new date that you can see. // The simplest way to avoid this is to disable the text field. :-( dp.getEditor().setDisable(true); datePickers.add(dp); return picker; }
Example 8
Source File: TablePane.java From Intro-to-Java-Programming with MIT License | 5 votes |
/** Return a table */ private VBox getTable(TextField x, TextField y, TextField width, TextField height, int n) { VBox vBox = new VBox(2); vBox.setStyle("-fx-border-color: Black"); vBox.getChildren().addAll(new Label("Enter rectangle " + n + " info:"), getGrid(x, y, width, height)); return vBox; }
Example 9
Source File: GameElimniationController.java From MyBox with Apache License 2.0 | 5 votes |
protected void focusStyle(int i, int j) { try { final VBox vbox1 = chessBoard.get(i + "-" + j); vbox1.setStyle(focusStyle); } catch (Exception e) { logger.debug(e.toString()); } }
Example 10
Source File: Carousel.java From DashboardFx with GNU General Public License v3.0 | 5 votes |
private ObservableList<Node> createItems(){ Label lb1 = new Label("First"); Label lb2 = new Label("Second"); Label lb3 = new Label("Third"); Label lb4 = new Label("Fourth"); Label lb5 = new Label("Fifth"); lb1.setStyle("-fx-text-fill : white;"); lb2.setStyle("-fx-text-fill : white;"); lb3.setStyle("-fx-text-fill : white;"); lb4.setStyle("-fx-text-fill : white;"); lb5.setStyle("-fx-text-fill : white;"); VBox v1 = new VBox(lb1); VBox v2 = new VBox(lb2); VBox v3 = new VBox(lb3); VBox v4 = new VBox(lb4); VBox v5 = new VBox(lb5); v1.setAlignment(Pos.CENTER); v2.setAlignment(Pos.CENTER); v3.setAlignment(Pos.CENTER); v4.setAlignment(Pos.CENTER); v5.setAlignment(Pos.CENTER); v1.setStyle("-fx-background-color : #FF3547;"); v2.setStyle("-fx-background-color : #512DA8;"); v3.setStyle("-fx-background-color : #48CFAD;"); v4.setStyle("-fx-background-color : #02C852;"); v5.setStyle("-fx-background-color : #EC407A;"); return FXCollections.observableArrayList(v1, v2, v3, v4, v5); }
Example 11
Source File: HtmlWebView.java From Learn-Java-12-Programming with MIT License | 5 votes |
public void start10(Stage primaryStage) { Text txt = new Text("Enjoy searching the Web!"); WebView wv = new WebView(); WebEngine we = wv.getEngine(); we.load("http://www.google.com"); //wv.setZoom(1.5); /* WebHistory history = we.getHistory(); ObservableList<WebHistory.Entry> entries = history.getEntries(); for(WebHistory.Entry entry: entries){ String url = entry.getUrl(); String title = entry.getTitle(); Date date = entry.getLastVisitedDate(); } */ VBox vb = new VBox(txt, wv); vb.setSpacing(20); vb.setAlignment(Pos.CENTER); vb.setStyle("-fx-font-size: 20px;-fx-background-color: lightblue;"); vb.setPadding(new Insets(10, 10, 10, 10)); Scene scene = new Scene(vb,750,500); primaryStage.setScene(scene); primaryStage.setTitle("JavaFX with the window to another server"); primaryStage.onCloseRequestProperty() .setValue(e -> System.out.println("Bye! See you later!")); primaryStage.show(); }
Example 12
Source File: AboutStage.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Parent getContentPane() { VBox root = new VBox(); root.setStyle("-fx-background-color:black"); root.getStyleClass().add("about-stage"); root.setId("aboutStage"); root.getChildren().addAll(FXUIUtils.getImage("marathon-splash"), infoBox, buttonBar); return root; }
Example 13
Source File: MarathonSplashScreen.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Parent getContentPane() { VBox root = new VBox(); root.setStyle("-fx-background-color:black"); root.setId("marathonITESplashScreen"); root.getStyleClass().add("marathonite-splash-screen"); root.getChildren().addAll(FXUIUtils.getImage("marathon-splash"), createInfo()); Timeline timeline = new Timeline(new KeyFrame(SPLASH_DISPLAY_TIME, (e) -> { dispose(); })); timeline.play(); return root; }
Example 14
Source File: TransfersTab.java From xframium-java with GNU General Public License v3.0 | 4 votes |
public TransfersTab (Screen screen, TSOCommand tsoCommand) { super ("Transfers", screen, tsoCommand); btnTracks.setSelected (true); btnFiles.setSelected (true); btnFB.setSelected (true); grpFileName.getToggles ().addAll (btnDatasets, btnFiles, btnJobs, btnSpecify); grpSpaceUnits.getToggles ().addAll (btnTracks, btnCylinders, btnBlocks); grpFileName.selectedToggleProperty () .addListener ( (ov, oldToggle, newToggle) -> toggleSelected (newToggle)); grpSpaceUnits.selectedToggleProperty () .addListener ( (ov, oldToggle, newToggle) -> toggleSelected (newToggle)); VBox datasetBlock = new VBox (10); datasetBlock.setPadding (new Insets (10, 10, 10, 10)); HBox line1 = getLine (btnDatasets, txtDatasets); HBox line2 = getLine (btnJobs, txtJobs); HBox line3 = getLine (btnFiles, txtFiles); HBox line4 = getLine (btnSpecify, txtSpecify); txtDatasets.setPromptText ("no dataset selected"); txtJobs.setPromptText ("no batch job selected"); txtFiles.setPromptText ("no file selected"); txtSpecify.setEditable (true); txtBlksize.setText ("0"); txtLrecl.setText ("80"); datasetBlock.getChildren ().addAll (line1, line2, line3, line4); VBox spaceBlock = new VBox (10); spaceBlock.setPadding (new Insets (10, 10, 10, 10)); HBox line5 = getLine (lblLrecl, txtLrecl); HBox line6 = getLine (lblBlksize, txtBlksize); HBox line7 = getLine (btnTracks, btnCylinders, btnBlocks); HBox line8 = getLine (lblSpace, txtSpace, line7); HBox line9 = getLine (btnFB, btnPS); HBox line10 = getLine (lblDisposition, line9); spaceBlock.getChildren ().addAll (line10, line5, line6, line8); datasetBlock.setStyle ("-fx-border-color: grey; -fx-border-width: 1;" + " -fx-border-insets: 10"); spaceBlock.setStyle ("-fx-border-color: grey; -fx-border-width: 1;" + " -fx-border-insets: 10"); txtDescription.setText ("Not finished yet"); VBox columnLeft = new VBox (); columnLeft.setPadding (new Insets (10, 10, 10, 10)); columnLeft.getChildren ().addAll (datasetBlock, spaceBlock); VBox columnRight = new VBox (); columnRight.setPadding (new Insets (10, 10, 10, 10)); columnRight.getChildren ().addAll (txtDescription); BorderPane borderPane = new BorderPane (); borderPane.setLeft (columnLeft); borderPane.setRight (columnRight); setContent (borderPane); }
Example 15
Source File: FxWebViewExample3.java From marathonv5 with Apache License 2.0 | 4 votes |
@Override public void start(final Stage stage) { // Create the WebView WebView webView = new WebView(); // Update the stage title when a new web page title is available webView.getEngine().titleProperty().addListener(new ChangeListener<String>() { public void changed(ObservableValue<? extends String> ov, final String oldvalue, final String newvalue) { // Set the Title of the Stage stage.setTitle(newvalue); } }); // Load the Google web page String homePageUrl = "http://www.google.com"; // Create the WebMenu MenuButton menu = new WebMenu(webView); // Create the Navigation Bar NavigationBar navigationBar = new NavigationBar(webView, homePageUrl, true); // Add the children to the Navigation Bar navigationBar.getChildren().add(menu); // Create the VBox VBox root = new VBox(navigationBar, webView); // Set the Style-properties of the VBox root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue;"); // Create the Scene Scene scene = new Scene(root); // Add the Scene to the Stage stage.setScene(scene); // Display the Stage stage.show(); }
Example 16
Source File: DatePickerSample.java From marathonv5 with Apache License 2.0 | 4 votes |
private void initUI() { VBox vbox = new VBox(20); vbox.setStyle("-fx-padding: 10;"); Scene scene = new Scene(vbox, 400, 400); stage.setScene(scene); checkInDatePicker = new DatePicker(); checkOutDatePicker = new DatePicker(); checkInDatePicker.setValue(LocalDate.now()); final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(checkInDatePicker.getValue().plusDays(1))) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } long p = ChronoUnit.DAYS.between(checkInDatePicker.getValue(), item); setTooltip(new Tooltip("You're about to stay for " + p + " days")); } }; } }; checkOutDatePicker.setDayCellFactory(dayCellFactory); checkOutDatePicker.setValue(checkInDatePicker.getValue().plusDays(1)); checkInDatePicker.setChronology(ThaiBuddhistChronology.INSTANCE); checkOutDatePicker.setChronology(HijrahChronology.INSTANCE); GridPane gridPane = new GridPane(); gridPane.setHgap(10); gridPane.setVgap(10); Label checkInlabel = new Label("Check-In Date:"); gridPane.add(checkInlabel, 0, 0); GridPane.setHalignment(checkInlabel, HPos.LEFT); gridPane.add(checkInDatePicker, 0, 1); Label checkOutlabel = new Label("Check-Out Date:"); gridPane.add(checkOutlabel, 0, 2); GridPane.setHalignment(checkOutlabel, HPos.LEFT); gridPane.add(checkOutDatePicker, 0, 3); vbox.getChildren().add(gridPane); }
Example 17
Source File: PersonTypeCellFactory.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@Override public TableCell<Person, String> call(TableColumn<Person, String> param) { return new ComboBoxTableCell<Person, String>(new DefaultStringConverter()) { { ContextMenu cm = new ContextMenu(); MenuItem deletePersonsMenuItem = new MenuItem("Delete"); deletePersonsMenuItem.setOnAction( PersonTypeCellFactory.this.deletePersonsHandler ); cm.getItems().add(deletePersonsMenuItem); this.setContextMenu(cm); this.getItems().addAll( "Friend", "Co-worker", "Other" ); this.setEditable(true); } @Override public void updateItem(String arg0, boolean empty) { super.updateItem(arg0, empty); if( !empty ) { this.setText( arg0 ); } else { this.setText( null ); // clear from recycled obj } } @SuppressWarnings("unchecked") @Override public void commitEdit(String newValue) { super.commitEdit(newValue); TableRow<Person> row = this.getTableRow(); Person p = row.getItem(); String msg = p.validate(); if( logger.isLoggable(Level.FINE) ) { logger.fine("[COMMIT EDIT] validate=" + msg); } if( msg == null || msg.isEmpty() ) { if( logger.isLoggable(Level.FINE) ) { logger.fine("[COMMIT EDIT] validation passed"); } Task<Void> task = new Task<Void>() { @Override protected Void call() { dao.updatePerson(p); // updates AR too return null; } }; new Thread(task).start(); } else { System.out.println("layoutBounds=" + this.getLayoutBounds()); System.out.println("boundsInLocal=" + this.getBoundsInLocal()); System.out.println("boundsInParent=" + this.getBoundsInParent()); System.out.println("boundsInParent (Scene)=" + this.localToScene(this.getBoundsInParent())); System.out.println("boundsInParent (Screen)=" + this.localToScreen(this.getBoundsInParent())); System.out.println("row layoutBounds=" + row.getLayoutBounds()); System.out.println("row boundsInLocal=" + row.getBoundsInLocal()); System.out.println("row boundsInParent=" + row.getBoundsInParent()); System.out.println("row boundsInParent (Scene)=" + row.localToScene(this.getBoundsInParent())); System.out.println("row boundsInParent (Screen)=" + row.localToScreen(this.getBoundsInParent())); VBox vbox = new VBox(); vbox.setPadding(new Insets(10.0d)); vbox.setStyle("-fx-background-color: white; -fx-border-color: red"); vbox.getChildren().add( new Label(msg)); //vbox.setEffect(new DropShadow()); Popup popup = new Popup(); popup.getContent().add( vbox ); popup.setAutoHide(true); popup.setOnShown((evt) -> { System.out.println("vbox layoutBounds=" + vbox.getLayoutBounds()); System.out.println("vbox boundsInLocal=" + vbox.getBoundsInLocal()); System.out.println("vbox boundsInParent=" + vbox.getBoundsInParent()); System.out.println("vbox boundsInParent (Scene)=" + vbox.localToScene(this.getBoundsInParent())); System.out.println("vbox boundsInParent (Screen)=" + vbox.localToScreen(this.getBoundsInParent())); }); popup.show( row, row.localToScreen(row.getBoundsInParent()).getMinX(), row.localToScreen(row.getBoundsInParent()).getMaxY()); } } }; }
Example 18
Source File: GameElimniationController.java From MyBox with Apache License 2.0 | 4 votes |
protected void makeChessBoard() { if (isSettingValues) { return; } try { chessBoard.clear(); chessboardPane.getChildren().clear(); chessboardPane.setPrefWidth((chessSize + 20) * boardSize); chessboardPane.setPrefHeight((chessSize + 20) * boardSize); DropShadow effect = new DropShadow(); boolean shadow = shadowCheck.isSelected(); boolean arc = arcCheck.isSelected(); currentStyle = defaultStyle; if (arc) { currentStyle = arcStyle; } else if (shadow) { currentStyle = shadowStyle; } for (int i = 1; i <= boardSize; ++i) { HBox line = new HBox(); line.setAlignment(Pos.CENTER); line.setSpacing(10); chessboardPane.getChildren().add(line); VBox.setVgrow(line, Priority.NEVER); HBox.setHgrow(line, Priority.NEVER); for (int j = 1; j <= boardSize; ++j) { VBox vbox = new VBox(); vbox.setAlignment(Pos.CENTER); VBox.setVgrow(vbox, Priority.NEVER); HBox.setHgrow(vbox, Priority.NEVER); vbox.setSpacing(6); if (shadow) { vbox.setEffect(effect); } vbox.setStyle(currentStyle); final int x = i, y = j; vbox.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chessClicked(x, y); } }); line.getChildren().add(vbox); chessBoard.put(i + "-" + j, vbox); } } } catch (Exception e) { logger.debug(e.toString()); } }
Example 19
Source File: AssigneePickerDialog.java From HubTurbo with GNU Lesser General Public License v3.0 | 4 votes |
private VBox createMatchingUsersBox() { VBox matchingUsersBox = new VBox(); matchingUsersBox.setMinHeight(198); matchingUsersBox.setStyle("-fx-background-color: white;"); return matchingUsersBox; }
Example 20
Source File: PersonsCellFactory.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@Override public TableCell<Person, String> call(TableColumn<Person, String> param) { return new TextFieldTableCell<Person, String>(new DefaultStringConverter()) { { ContextMenu cm = new ContextMenu(); MenuItem deletePersonsMenuItem = new MenuItem("Delete"); deletePersonsMenuItem.setOnAction( PersonsCellFactory.this.deletePersonsHandler ); cm.getItems().add(deletePersonsMenuItem); this.setContextMenu(cm); } @Override public void updateItem(String arg0, boolean empty) { super.updateItem(arg0, empty); if( !empty ) { this.setText( arg0 ); } else { this.setText( null ); // clear from recycled obj } } @SuppressWarnings("unchecked") @Override public void commitEdit(String newValue) { super.commitEdit(newValue); TableRow<Person> row = this.getTableRow(); Person p = row.getItem(); String msg = p.validate(); if( logger.isLoggable(Level.FINE) ) { logger.fine("[COMMIT EDIT] validate=" + msg); } if( msg == null || msg.isEmpty() ) { if( logger.isLoggable(Level.FINE) ) { logger.fine("[COMMIT EDIT] validation passed"); } Task<Void> task = new Task<Void>() { @Override protected Void call() { dao.updatePerson(p); // updates AR too return null; } }; new Thread(task).start(); } else { System.out.println("layoutBounds=" + this.getLayoutBounds()); System.out.println("boundsInLocal=" + this.getBoundsInLocal()); System.out.println("boundsInParent=" + this.getBoundsInParent()); System.out.println("boundsInParent (Scene)=" + this.localToScene(this.getBoundsInParent())); System.out.println("boundsInParent (Screen)=" + this.localToScreen(this.getBoundsInParent())); System.out.println("row layoutBounds=" + row.getLayoutBounds()); System.out.println("row boundsInLocal=" + row.getBoundsInLocal()); System.out.println("row boundsInParent=" + row.getBoundsInParent()); System.out.println("row boundsInParent (Scene)=" + row.localToScene(this.getBoundsInParent())); System.out.println("row boundsInParent (Screen)=" + row.localToScreen(this.getBoundsInParent())); VBox vbox = new VBox(); vbox.setPadding(new Insets(10.0d)); vbox.setStyle("-fx-background-color: white; -fx-border-color: red"); vbox.getChildren().add( new Label(msg)); //vbox.setEffect(new DropShadow()); Popup popup = new Popup(); popup.getContent().add( vbox ); popup.setAutoHide(true); popup.setOnShown((evt) -> { System.out.println("vbox layoutBounds=" + vbox.getLayoutBounds()); System.out.println("vbox boundsInLocal=" + vbox.getBoundsInLocal()); System.out.println("vbox boundsInParent=" + vbox.getBoundsInParent()); System.out.println("vbox boundsInParent (Scene)=" + vbox.localToScene(this.getBoundsInParent())); System.out.println("vbox boundsInParent (Screen)=" + vbox.localToScreen(this.getBoundsInParent())); }); popup.show( row, row.localToScreen(row.getBoundsInParent()).getMinX(), row.localToScreen(row.getBoundsInParent()).getMaxY()); } } }; }