List of usage examples for javafx.scene.layout ColumnConstraints setPercentWidth
public final void setPercentWidth(double value)
From source file:Main.java
@Override public void start(final Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 400, 300, Color.WHITE); GridPane gridpane = new GridPane(); ColumnConstraints col1 = new ColumnConstraints(); col1.setPercentWidth(25); ColumnConstraints col2 = new ColumnConstraints(); col2.setPercentWidth(50);/*from w w w . j a va 2 s. c o m*/ ColumnConstraints col3 = new ColumnConstraints(); col3.setPercentWidth(25); gridpane.getColumnConstraints().addAll(col1, col2, col3); gridpane.add(new Label("2"), 2, 0); gridpane.add(new Label("1"), 1, 0); gridpane.add(new Label("0"), 0, 0); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:at.ac.tuwien.qse.sepm.gui.controller.impl.HighlightsViewControllerImpl.java
@FXML private void initialize() { tagImageTiles.addAll(Arrays.asList(tag1, tag2, tag3, tag4, tag5)); wikipediaInfoPane = new WikipediaInfoPane(wikipediaService); HBox.setHgrow(wikipediaInfoPane, Priority.ALWAYS); wikipediaInfoPaneContainer.getChildren().addAll(wikipediaInfoPane, wikipediaPlaceholder); wikipediaPlaceholder.setGlyphSize(80); wikipediaInfoPaneContainer.setAlignment(Pos.CENTER); wikipediaPlaceholder.getStyleClass().addAll("wikipedia-placeholder"); wikipediaInfoPane.managedProperty().bind(wikipediaInfoPane.visibleProperty()); wikipediaPlaceholder.visibleProperty().bind(wikipediaInfoPane.visibleProperty().not()); wikipediaInfoPane.setVisible(false); journeyPlaceList.setOnJourneySelected(this::handleJourneySelected); journeyPlaceList.setOnPlaceSelected(this::handlePlaceSelected); journeyPlaceList.setOnAllPlacesSelected(this::handleAllPlacesSelected); // give each row and each column in the grid the same size ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); ColumnConstraints column2 = new ColumnConstraints(); column2.setPercentWidth(25);//from w w w . j ava 2 s .c o m ColumnConstraints column3 = new ColumnConstraints(); column3.setPercentWidth(25); ColumnConstraints column4 = new ColumnConstraints(); column4.setPercentWidth(25); gridPane.getColumnConstraints().addAll(column1, column2, column3, column4); RowConstraints row1 = new RowConstraints(); row1.setPercentHeight(33); RowConstraints row2 = new RowConstraints(); row2.setPercentHeight(33); RowConstraints row3 = new RowConstraints(); row3.setPercentHeight(33); gridPane.getRowConstraints().addAll(row1, row2, row3); clusterService.subscribeJourneyChanged((journey) -> scheduler .schedule(() -> Platform.runLater(this::reloadJourneys), 2, TimeUnit.SECONDS)); clusterService.subscribePlaceChanged( (place) -> scheduler.schedule(() -> Platform.runLater(this::reloadJourneys), 2, TimeUnit.SECONDS)); photoService.subscribeCreate(addBuffer::add); reloadJourneys(); }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
private void setupGridPaneColumns() { ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(50); ColumnConstraints column2 = new ColumnConstraints(); column2.setPercentWidth(50);/* www . j av a 2s . co m*/ getColumnConstraints().addAll(column1, column2); }
From source file:se.trixon.filebydate.ui.ProfilePanel.java
private void createUI() { //setGridLinesVisible(true); Label nameLabel = new Label(Dict.NAME.toString()); Label descLabel = new Label(Dict.DESCRIPTION.toString()); Label filePatternLabel = new Label(Dict.FILE_PATTERN.toString()); Label dateSourceLabel = new Label(Dict.DATE_SOURCE.toString()); mDatePatternLabel = new Label(Dict.DATE_PATTERN.toString()); Label operationLabel = new Label(Dict.OPERATION.toString()); Label caseBaseLabel = new Label(Dict.BASENAME.toString()); Label caseExtLabel = new Label(Dict.EXTENSION.toString()); mLinksCheckBox = new CheckBox(Dict.FOLLOW_LINKS.toString()); mRecursiveCheckBox = new CheckBox(Dict.RECURSIVE.toString()); mReplaceCheckBox = new CheckBox(Dict.REPLACE.toString()); mCaseBaseComboBox = new ComboBox<>(); mDatePatternComboBox = new ComboBox<>(); mDateSourceComboBox = new ComboBox<>(); mFilePatternComboBox = new ComboBox<>(); mOperationComboBox = new ComboBox<>(); mCaseExtComboBox = new ComboBox<>(); mNameTextField = new TextField(); mDescTextField = new TextField(); mSourceChooserPane = new FileChooserPane(Dict.OPEN.toString(), Dict.SOURCE.toString(), ObjectMode.DIRECTORY, SelectionMode.SINGLE);//from w w w . j a v a 2 s . co m mDestChooserPane = new FileChooserPane(Dict.OPEN.toString(), Dict.DESTINATION.toString(), ObjectMode.DIRECTORY, SelectionMode.SINGLE); mFilePatternComboBox.setEditable(true); mDatePatternComboBox.setEditable(true); //mDatePatternLabel.setPrefWidth(300); int col = 0; int row = 0; add(nameLabel, col, row, REMAINING, 1); add(mNameTextField, col, ++row, REMAINING, 1); add(descLabel, col, ++row, REMAINING, 1); add(mDescTextField, col, ++row, REMAINING, 1); add(mSourceChooserPane, col, ++row, REMAINING, 1); add(mDestChooserPane, col, ++row, REMAINING, 1); GridPane patternPane = new GridPane(); patternPane.addRow(0, filePatternLabel, dateSourceLabel, mDatePatternLabel); patternPane.addRow(1, mFilePatternComboBox, mDateSourceComboBox, mDatePatternComboBox); patternPane.setHgap(8); addRow(++row, patternPane); GridPane.setHgrow(mFilePatternComboBox, Priority.ALWAYS); GridPane.setHgrow(mDateSourceComboBox, Priority.ALWAYS); GridPane.setHgrow(mDatePatternComboBox, Priority.ALWAYS); GridPane.setFillWidth(mFilePatternComboBox, true); GridPane.setFillWidth(mDateSourceComboBox, true); GridPane.setFillWidth(mDatePatternComboBox, true); double width = 100.0 / 3.0; ColumnConstraints col1 = new ColumnConstraints(); col1.setPercentWidth(width); ColumnConstraints col2 = new ColumnConstraints(); col2.setPercentWidth(width); ColumnConstraints col3 = new ColumnConstraints(); col3.setPercentWidth(width); patternPane.getColumnConstraints().addAll(col1, col2, col3); mFilePatternComboBox.setMaxWidth(Double.MAX_VALUE); mDateSourceComboBox.setMaxWidth(Double.MAX_VALUE); mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE); GridPane subPane = new GridPane(); //subPane.setGridLinesVisible(true); subPane.addRow(0, operationLabel, new Label(), new Label(), new Label(), caseBaseLabel, caseExtLabel); subPane.addRow(1, mOperationComboBox, mLinksCheckBox, mRecursiveCheckBox, mReplaceCheckBox, mCaseBaseComboBox, mCaseExtComboBox); subPane.setHgap(8); add(subPane, col, ++row, REMAINING, 1); final Insets rowInsets = new Insets(0, 0, 8, 0); GridPane.setMargin(mNameTextField, rowInsets); GridPane.setMargin(mDescTextField, rowInsets); GridPane.setMargin(mSourceChooserPane, rowInsets); GridPane.setMargin(mDestChooserPane, rowInsets); GridPane.setMargin(patternPane, rowInsets); mFilePatternComboBox.setItems(FXCollections.observableArrayList("*", "{*.jpg,*.JPG}", "{*.mp4,*.MP4}")); mDatePatternComboBox.setItems(FXCollections.observableArrayList("yyyy/MM/yyyy-MM-dd", "yyyy/MM/yyyy-MM-dd/HH", "yyyy/MM/dd", "yyyy/ww", "yyyy/ww/u")); mCaseBaseComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(NameCase.values()))); mCaseExtComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(NameCase.values()))); mDateSourceComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(DateSource.values()))); mOperationComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(Command.COPY, Command.MOVE))); }