List of usage examples for javafx.geometry VPos TOP
VPos TOP
To view the source code for javafx.geometry VPos TOP.
Click Source Link
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = SceneBuilder.create().width(320).height(343) .root(GroupBuilder.create()/*from www. j a v a2s . co 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:Main.java
static Node lighting() { Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0f);/* www. j av a 2 s .c o m*/ Lighting l = new Lighting(); l.setLight(light); l.setSurfaceScale(5.0f); Text t = new Text(); t.setText("JavaFX\nLighting!"); t.setFill(Color.RED); t.setFont(Font.font("null", FontWeight.BOLD, 70)); t.setX(500.0f); t.setY(100.0f); t.setTextOrigin(VPos.TOP); t.setEffect(l); t.setTranslateX(0); t.setTranslateY(320); return t; }
From source file:AudioPlayer3.java
@Override protected Node initView() { final Label title = createLabel("title"); final Label artist = createLabel("artist"); final Label album = createLabel("album"); final Label year = createLabel("year"); final ImageView albumCover = createAlbumCover(); title.textProperty().bind(songModel.titleProperty()); artist.textProperty().bind(songModel.artistProperty()); album.textProperty().bind(songModel.albumProperty()); year.textProperty().bind(songModel.yearProperty()); albumCover.imageProperty().bind(songModel.albumCoverProperty()); final GridPane gp = new GridPane(); gp.setPadding(new Insets(10)); gp.setHgap(20);/* w w w.j av a2 s . c o m*/ gp.add(albumCover, 0, 0, 1, GridPane.REMAINING); gp.add(title, 1, 0); gp.add(artist, 1, 1); gp.add(album, 1, 2); gp.add(year, 1, 3); final ColumnConstraints c0 = new ColumnConstraints(); final ColumnConstraints c1 = new ColumnConstraints(); c1.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(c0, c1); final RowConstraints r0 = new RowConstraints(); r0.setValignment(VPos.TOP); gp.getRowConstraints().addAll(r0, r0, r0, r0); return gp; }
From source file:Main.java
private GridPane addGridPane() { GridPane grid = new GridPane(); grid.setHgap(10);// ww w . j a v a 2 s.c om grid.setVgap(10); grid.setPadding(new Insets(0, 10, 0, 10)); // Category in column 2, row 1 Text category = new Text("Sales:"); category.setFont(Font.font("Arial", FontWeight.BOLD, 20)); grid.add(category, 1, 0); // Title in column 3, row 1 Text chartTitle = new Text("Current Year"); chartTitle.setFont(Font.font("Arial", FontWeight.BOLD, 20)); grid.add(chartTitle, 2, 0); // Subtitle in columns 2-3, row 2 Text chartSubtitle = new Text("Goods and Services"); grid.add(chartSubtitle, 1, 1, 2, 1); // House icon in column 1, rows 1-2 ImageView imageHouse = new ImageView(new Image(Main.class.getResourceAsStream("graphics/house.png"))); grid.add(imageHouse, 0, 0, 1, 2); // Left label in column 1 (bottom), row 3 Text goodsPercent = new Text("Goods\n80%"); GridPane.setValignment(goodsPercent, VPos.BOTTOM); grid.add(goodsPercent, 0, 2); // Chart in columns 2-3, row 3 ImageView imageChart = new ImageView(new Image(Main.class.getResourceAsStream("graphics/piechart.png"))); grid.add(imageChart, 1, 2, 2, 1); // Right label in column 4 (top), row 3 Text servicesPercent = new Text("Services\n20%"); GridPane.setValignment(servicesPercent, VPos.TOP); grid.add(servicesPercent, 3, 2); // grid.setGridLinesVisible(true); return grid; }
From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java
private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList, List<Country> dataProvider) { Label label = addLabel(gridPane, ++gridRow, title, 0); label.setWrapText(true);/*from w ww. ja v a2s . c o m*/ label.setMaxWidth(180); label.setTextAlignment(TextAlignment.RIGHT); GridPane.setHalignment(label, HPos.RIGHT); GridPane.setValignment(label, VPos.TOP); FlowPane flowPane = new FlowPane(); flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10); flowPane.setHgap(10); flowPane.setMinHeight(55); if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); dataProvider.stream().forEach(country -> { final String countryCode = country.code; CheckBox checkBox = new CheckBox(countryCode); checkBox.setUserData(countryCode); checkBoxList.add(checkBox); checkBox.setMouseTransparent(!isEditable); checkBox.setMinWidth(45); checkBox.setMaxWidth(45); checkBox.setTooltip(new Tooltip(country.name)); checkBox.setOnAction(event -> { if (checkBox.isSelected()) sepaAccount.addAcceptedCountry(countryCode); else sepaAccount.removeAcceptedCountry(countryCode); updateAllInputsValid(); }); flowPane.getChildren().add(checkBox); }); updateCountriesSelection(isEditable, checkBoxList); GridPane.setRowIndex(flowPane, gridRow); GridPane.setColumnIndex(flowPane, 1); gridPane.getChildren().add(flowPane); }
From source file:AudioPlayer3.java
@Override protected Node initView() { final Button openButton = createOpenButton(); controlPanel = createControlPanel(); volumeSlider = createSlider("volumeSlider"); statusLabel = createLabel("Buffering", "statusDisplay"); positionSlider = createSlider("positionSlider"); totalDurationLabel = createLabel("00:00", "mediaText"); currentTimeLabel = createLabel("00:00", "mediaText"); positionSlider.valueChangingProperty().addListener(new PositionListener()); final ImageView volLow = new ImageView(); volLow.setId("volumeLow"); final ImageView volHigh = new ImageView(); volHigh.setId("volumeHigh"); final GridPane gp = new GridPane(); gp.setHgap(1);/*from w w w. j a v a 2s . com*/ gp.setVgap(1); gp.setPadding(new Insets(10)); final ColumnConstraints buttonCol = new ColumnConstraints(100); final ColumnConstraints spacerCol = new ColumnConstraints(40, 80, 80); final ColumnConstraints middleCol = new ColumnConstraints(); middleCol.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(buttonCol, spacerCol, middleCol, spacerCol, buttonCol); GridPane.setValignment(openButton, VPos.BOTTOM); GridPane.setHalignment(volHigh, HPos.RIGHT); GridPane.setValignment(volumeSlider, VPos.TOP); GridPane.setHalignment(statusLabel, HPos.RIGHT); GridPane.setValignment(statusLabel, VPos.TOP); GridPane.setHalignment(currentTimeLabel, HPos.RIGHT); gp.add(openButton, 0, 0, 1, 3); gp.add(volLow, 1, 0); gp.add(volHigh, 1, 0); gp.add(volumeSlider, 1, 1); gp.add(controlPanel, 2, 0, 1, 2); gp.add(statusLabel, 3, 1); gp.add(currentTimeLabel, 1, 2); gp.add(positionSlider, 2, 2); gp.add(totalDurationLabel, 3, 2); return gp; }
From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginView.java
@Override public Region getContent() { if (hBox == null) { VBox statedInferredToggleGroupVBox = new VBox(); statedInferredToggleGroupVBox.setSpacing(4.0); //Instantiate Everything pathComboBox = new ComboBox<>(); //Path statedInferredToggleGroup = new ToggleGroup(); //Stated / Inferred List<RadioButton> statedInferredOptionButtons = new ArrayList<>(); datePicker = new DatePicker(); //Date timeSelectCombo = new ComboBox<Long>(); //Time //Radio buttons for (StatedInferredOptions option : StatedInferredOptions.values()) { RadioButton optionButton = new RadioButton(); if (option == StatedInferredOptions.STATED) { optionButton.setText("Stated"); } else if (option == StatedInferredOptions.INFERRED_THEN_STATED) { optionButton.setText("Inferred Then Stated"); } else if (option == StatedInferredOptions.INFERRED) { optionButton.setText("Inferred"); } else { throw new RuntimeException("oops"); }/*from w w w .j a v a 2s . c om*/ optionButton.setUserData(option); optionButton.setTooltip( new Tooltip("Default StatedInferredOption is " + getDefaultStatedInferredOption())); statedInferredToggleGroup.getToggles().add(optionButton); statedInferredToggleGroupVBox.getChildren().add(optionButton); statedInferredOptionButtons.add(optionButton); } statedInferredToggleGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() { @Override public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) { currentStatedInferredOptionProperty.set((StatedInferredOptions) newValue.getUserData()); } }); //Path Combo Box pathComboBox.setCellFactory(new Callback<ListView<UUID>, ListCell<UUID>>() { @Override public ListCell<UUID> call(ListView<UUID> param) { final ListCell<UUID> cell = new ListCell<UUID>() { @Override protected void updateItem(UUID c, boolean emptyRow) { super.updateItem(c, emptyRow); if (c == null) { setText(null); } else { String desc = OTFUtility.getDescription(c); setText(desc); } } }; return cell; } }); pathComboBox.setButtonCell(new ListCell<UUID>() { // Don't know why this should be necessary, but without this the UUID itself is displayed @Override protected void updateItem(UUID c, boolean emptyRow) { super.updateItem(c, emptyRow); if (emptyRow) { setText(""); } else { String desc = OTFUtility.getDescription(c); setText(desc); } } }); pathComboBox.setOnAction((event) -> { if (!pathComboFirstRun) { UUID selectedPath = pathComboBox.getSelectionModel().getSelectedItem(); if (selectedPath != null) { int path = OTFUtility.getConceptVersion(selectedPath).getPathNid(); StampBdb stampDb = Bdb.getStampDb(); NidSet nidSet = new NidSet(); nidSet.add(path); //TODO: Make this multi-threaded and possibly implement setTimeOptions() here also NidSetBI stamps = stampDb.getSpecifiedStamps(nidSet, Long.MIN_VALUE, Long.MAX_VALUE); pathDatesList.clear(); // disableTimeCombo(true); timeSelectCombo.setValue(Long.MAX_VALUE); for (Integer thisStamp : stamps.getAsSet()) { try { Position stampPosition = stampDb.getPosition(thisStamp); this.stampDate = new Date(stampPosition.getTime()); stampDateInstant = stampDate.toInstant().atZone(ZoneId.systemDefault()) .toLocalDate(); this.pathDatesList.add(stampDateInstant); //Build DatePicker } catch (Exception e) { e.printStackTrace(); } } datePicker.setValue(LocalDate.now()); } } else { pathComboFirstRun = false; } }); pathComboBox.setTooltip( new Tooltip("Default path is \"" + OTFUtility.getDescription(getDefaultPath()) + "\"")); //Calendar Date Picker final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate thisDate, boolean empty) { super.updateItem(thisDate, empty); if (pathDatesList != null) { if (pathDatesList.contains(thisDate)) { setDisable(false); } else { setDisable(true); } } } }; } }; datePicker.setDayCellFactory(dayCellFactory); datePicker.setOnAction((event) -> { if (!datePickerFirstRun) { UUID selectedPath = pathComboBox.getSelectionModel().getSelectedItem(); Instant instant = Instant.from(datePicker.getValue().atStartOfDay(ZoneId.systemDefault())); Long dateSelected = Date.from(instant).getTime(); if (selectedPath != null && dateSelected != 0) { int path = OTFUtility.getConceptVersion(selectedPath).getPathNid(); setTimeOptions(path, dateSelected); try { timeSelectCombo.setValue(times.first()); //Default Dropdown Value } catch (Exception e) { // Eat it.. like a sandwich! TODO: Create Read Only Property Conditional for checking if Time Combo is disabled // Right now, Sometimes Time Combo is disabled, so we catch this and eat it // Otherwise make a conditional from the Read Only Boolean Property to check first } } else { disableTimeCombo(false); logger.debug("The path isn't set or the date isn't set. Both are needed right now"); } } else { datePickerFirstRun = false; } }); //Commit-Time ComboBox timeSelectCombo.setMinWidth(200); timeSelectCombo.setCellFactory(new Callback<ListView<Long>, ListCell<Long>>() { @Override public ListCell<Long> call(ListView<Long> param) { final ListCell<Long> cell = new ListCell<Long>() { @Override protected void updateItem(Long item, boolean emptyRow) { super.updateItem(item, emptyRow); if (item == null) { setText(""); } else { if (item == Long.MAX_VALUE) { setText("LATEST TIME"); } else { setText(timeFormatter.format(new Date(item))); } } } }; return cell; } }); timeSelectCombo.setButtonCell(new ListCell<Long>() { @Override protected void updateItem(Long item, boolean emptyRow) { super.updateItem(item, emptyRow); if (item == null) { setText(""); } else { if (item == Long.MAX_VALUE) { setText("LATEST TIME"); } else { setText(timeFormatter.format(new Date(item))); } } } }); try { currentPathProperty.bind(pathComboBox.getSelectionModel().selectedItemProperty()); //Set Path Property currentTimeProperty.bind(timeSelectCombo.getSelectionModel().selectedItemProperty()); } catch (Exception e) { e.printStackTrace(); } // DEFAULT VALUES UserProfile loggedIn = ExtendedAppContext.getCurrentlyLoggedInUserProfile(); storedTimePref = loggedIn.getViewCoordinateTime(); storedPathPref = loggedIn.getViewCoordinatePath(); if (storedPathPref != null) { pathComboBox.getItems().clear(); //Set the path Dates by default pathComboBox.getItems().addAll(getPathOptions()); final UUID storedPath = getStoredPath(); if (storedPath != null) { pathComboBox.getSelectionModel().select(storedPath); } if (storedTimePref != null) { final Long storedTime = loggedIn.getViewCoordinateTime(); Calendar cal = Calendar.getInstance(); cal.setTime(new Date(storedTime)); cal.set(Calendar.MILLISECOND, 0); //Strip milliseconds Long storedTruncTime = cal.getTimeInMillis(); if (!storedTime.equals(Long.MAX_VALUE)) { //***** FIX THIS, not checking default vc time value int path = OTFUtility.getConceptVersion(storedPathPref).getPathNid(); setTimeOptions(path, storedTimePref); timeSelectCombo.setValue(storedTruncTime); // timeSelectCombo.getItems().addAll(getTimeOptions()); //The correct way, but doesen't work Date storedDate = new Date(storedTime); datePicker.setValue(storedDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); } else { datePicker.setValue(LocalDate.now()); timeSelectCombo.getItems().addAll(Long.MAX_VALUE); //The correct way, but doesen't work timeSelectCombo.setValue(Long.MAX_VALUE); // disableTimeCombo(false); } } else { //Stored Time Pref == null logger.error("ERROR: Stored Time Preference = null"); } } else { //Stored Path Pref == null logger.error("We could not load a stored path, ISAAC cannot run"); throw new Error("No stored PATH could be found. ISAAC can't run without a path"); } GridPane gridPane = new GridPane(); gridPane.setHgap(10); gridPane.setVgap(10); Label pathLabel = new Label("View Coordinate Path"); gridPane.add(pathLabel, 0, 0); //Path Label - Row 0 GridPane.setHalignment(pathLabel, HPos.LEFT); gridPane.add(statedInferredToggleGroupVBox, 1, 0, 1, 2); //--Row 0, span 2 gridPane.add(pathComboBox, 0, 1); //Path Combo box - Row 2 GridPane.setValignment(pathComboBox, VPos.TOP); Label datePickerLabel = new Label("View Coordinate Dates"); gridPane.add(datePickerLabel, 0, 2); //Row 3 GridPane.setHalignment(datePickerLabel, HPos.LEFT); gridPane.add(datePicker, 0, 3); //Row 4 Label timeSelectLabel = new Label("View Coordinate Times"); gridPane.add(timeSelectLabel, 1, 2); //Row 3 GridPane.setHalignment(timeSelectLabel, HPos.LEFT); gridPane.add(timeSelectCombo, 1, 3); //Row 4 // FOR DEBUGGING CURRENTLY SELECTED PATH, TIME AND POLICY /* UserProfile userProfile = ExtendedAppContext.getCurrentlyLoggedInUserProfile(); StatedInferredOptions chosenPolicy = userProfile.getStatedInferredPolicy(); UUID chosenPathUuid = userProfile.getViewCoordinatePath(); Long chosenTime = userProfile.getViewCoordinateTime(); Label printSelectedPathLabel = new Label("Path: " + OTFUtility.getDescription(chosenPathUuid)); gridPane.add(printSelectedPathLabel, 0, 4); GridPane.setHalignment(printSelectedPathLabel, HPos.LEFT); Label printSelectedTimeLabel = null; if(chosenTime != getDefaultTime()) { printSelectedTimeLabel = new Label("Time: " + dateFormat.format(new Date(chosenTime))); } else { printSelectedTimeLabel = new Label("Time: LONG MAX VALUE"); } gridPane.add(printSelectedTimeLabel, 1, 4); GridPane.setHalignment(printSelectedTimeLabel, HPos.LEFT); Label printSelectedPolicyLabel = new Label("Policy: " + chosenPolicy); gridPane.add(printSelectedPolicyLabel, 2, 4); GridPane.setHalignment(printSelectedPolicyLabel, HPos.LEFT); */ hBox = new HBox(); hBox.getChildren().addAll(gridPane); allValid_ = new ValidBooleanBinding() { { bind(currentStatedInferredOptionProperty, currentPathProperty, currentTimeProperty); setComputeOnInvalidate(true); } @Override protected boolean computeValue() { if (currentStatedInferredOptionProperty.get() == null) { this.setInvalidReason("Null/unset/unselected StatedInferredOption"); for (RadioButton button : statedInferredOptionButtons) { TextErrorColorHelper.setTextErrorColor(button); } return false; } else { for (RadioButton button : statedInferredOptionButtons) { TextErrorColorHelper.clearTextErrorColor(button); } } if (currentPathProperty.get() == null) { this.setInvalidReason("Null/unset/unselected path"); TextErrorColorHelper.setTextErrorColor(pathComboBox); return false; } else { TextErrorColorHelper.clearTextErrorColor(pathComboBox); } if (OTFUtility.getConceptVersion(currentPathProperty.get()) == null) { this.setInvalidReason("Invalid path"); TextErrorColorHelper.setTextErrorColor(pathComboBox); return false; } else { TextErrorColorHelper.clearTextErrorColor(pathComboBox); } // if(currentTimeProperty.get() == null && currentTimeProperty.get() != Long.MAX_VALUE) // { // this.setInvalidReason("View Coordinate Time is unselected"); // TextErrorColorHelper.setTextErrorColor(timeSelectCombo); // return false; // } this.clearInvalidReason(); return true; } }; } // createButton.disableProperty().bind(saveButtonValid.not())); // Reload persisted values every time final StatedInferredOptions storedStatedInferredOption = getStoredStatedInferredOption(); for (Toggle toggle : statedInferredToggleGroup.getToggles()) { if (toggle.getUserData() == storedStatedInferredOption) { toggle.setSelected(true); } } // pathComboBox.setButtonCell(new ListCell<UUID>() { // @Override // protected void updateItem(UUID c, boolean emptyRow) { // super.updateItem(c, emptyRow); // if (emptyRow) { // setText(""); // } else { // String desc = OTFUtility.getDescription(c); // setText(desc); // } // } // }); // timeSelectCombo.setButtonCell(new ListCell<Long>() { // @Override // protected void updateItem(Long item, boolean emptyRow) { // super.updateItem(item, emptyRow); // if (emptyRow) { // setText(""); // } else { // setText(timeFormatter.format(new Date(item))); // } // } // }); // datePickerFirstRun = false; // pathComboFirstRun = false; return hBox; }