本文整理汇总了Java中javafx.scene.layout.GridPane.setFillWidth方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setFillWidth方法的具体用法?Java GridPane.setFillWidth怎么用?Java GridPane.setFillWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setFillWidth方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FileSelection
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public FileSelection(File parent) {
DialogPane dialogPane = this.getDialogPane();
dialogPane.setMaxWidth(1.7976931348623157E308D);
this.directoryView = new CheckTreeView<>();
this.directoryView.setMaxWidth(1.7976931348623157E308D);
CheckBoxTreeItem<File> root = createTree(new CheckBoxTreeItem<>(parent));
root.setExpanded(true);
directoryView.setRoot(root);
GridPane.setHgrow(this.directoryView, Priority.ALWAYS);
GridPane.setFillWidth(this.directoryView, true);
this.grid = new GridPane();
this.grid.setHgap(10.0D);
this.grid.setMaxWidth(1.7976931348623157E308D);
this.grid.setAlignment(Pos.CENTER_LEFT);
dialogPane.contentTextProperty().addListener((o) -> this.updateGrid());
this.setTitle(ControlResources.getString("Dialog.confirm.title"));
dialogPane.setHeaderText(ControlResources.getString("Dialog.confirm.header"));
dialogPane.getStyleClass().add("text-input-dialog");
dialogPane.getButtonTypes().addAll(new ButtonType[] { ButtonType.APPLY, ButtonType.CANCEL });
this.updateGrid();
this.setResultConverter((dialogButton) -> {
ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
return data == ButtonData.APPLY ? this.getValues() : null;
});
}
示例2: TimeRangeViewSkin
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public TimeRangeViewSkin(TimeRangeView control) {
super(control);
Label overviewLabel = new Label();
overviewLabel.textProperty()
.bind(Bindings
.createStringBinding(
() -> control.getUnitsToPrint() == 0 ? ""
: Messages
.getString("TimeRangeViewSkin.PERIOD_LABEL", control.getUnitsToPrint(),
Messages.getString(
control.getViewType().getPluralChronoMessageKey())),
control.unitsToPrintProperty(), control.viewTypeProperty()));
GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("container");
gridPane.add(new Label(Messages.getString("TimeRangeViewSkin.START_LABEL")), 0, 0);
gridPane.add(control.getStartField(), 1, 0);
gridPane.add(new Label(Messages.getString("TimeRangeViewSkin.END_LABEL")), 0, 1);
gridPane.add(control.getEndField(), 1, 1);
gridPane.add(overviewLabel, 1, 2);
ColumnConstraints col1 = new ColumnConstraints();
ColumnConstraints col2 = new ColumnConstraints();
gridPane.getColumnConstraints().addAll(col1, col2);
GridPane.setHalignment(control.getStartField(), HPos.LEFT);
GridPane.setHalignment(control.getEndField(), HPos.LEFT);
GridPane.setFillWidth(control.getStartField(), true);
GridPane.setFillWidth(control.getEndField(), true);
getChildren().add(gridPane);
}
示例3: updateControl
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateControl() {
pane.getChildren().clear();
pane.getColumnConstraints().clear();
// the day views
WeekDayHeaderView view = getSkinnable();
final int numberOfDays = view.getNumberOfDays();
Callback<WeekDayHeaderView, WeekDayCell> cellFactory = view.getCellFactory();
for (int i = 0; i < numberOfDays; i++) {
ColumnConstraints con = new ColumnConstraints();
con.setPercentWidth((double) 100 / (double) numberOfDays);
pane.getColumnConstraints().add(con);
WeekDayCell cell = cellFactory.call(view);
GridPane.setHgrow(cell, Priority.ALWAYS);
GridPane.setVgrow(cell, Priority.ALWAYS);
GridPane.setFillHeight(cell, true);
GridPane.setFillWidth(cell, true);
final int dayCount = i;
/*
* TODO: listener must be removed when number of days change.
*/
view.dateProperty().addListener(evt -> updateCell(cell, dayCount));
updateCell(cell, dayCount);
pane.add(cell, i, 0);
}
}
示例4: updateBackgrounds
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateBackgrounds() {
// the day views
pane.getChildren().clear();
List<ColumnConstraints> constraints = new ArrayList<>();
int numberOfDays = getSkinnable().getNumberOfDays();
for (int i = 0; i < numberOfDays; i++) {
ColumnConstraints con = new ColumnConstraints();
con.setPercentWidth((double) 100 / (double) numberOfDays);
constraints.add(con);
Region region = new Region();
region.setMaxWidth(Double.MAX_VALUE);
region.getStyleClass().add(ALL_DAY_BACKGROUND_REGION);
GridPane.setHgrow(region, Priority.ALWAYS);
GridPane.setVgrow(region, Priority.ALWAYS);
GridPane.setFillHeight(region, true);
GridPane.setFillWidth(region, true);
final int day = i;
getSkinnable().dateProperty().addListener(evt -> updateRegion(region, day));
updateRegion(region, day);
pane.add(region, i, 0);
}
pane.getColumnConstraints().setAll(constraints);
getSkinnable().requestLayout();
}
示例5: TableDialog
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public TableDialog(Collection<T> files) {
dialogPane = getDialogPane();
setResizable(true);
this.table = new TableView<>(FXCollections.observableArrayList(files));
this.table.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(table, Priority.ALWAYS);
GridPane.setFillWidth(table, true);
label = createContentLabel(dialogPane.getContentText());
label.setPrefWidth(Region.USE_COMPUTED_SIZE);
label.textProperty().bind(dialogPane.contentTextProperty());
this.grid = new GridPane();
this.grid.setHgap(10);
this.grid.setMaxWidth(Double.MAX_VALUE);
this.grid.setAlignment(Pos.CENTER_LEFT);
dialogPane.contentTextProperty().addListener(o -> updateGrid());
updateGrid();
setResultConverter((dialogButton) -> {
ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
return data == ButtonBar.ButtonData.OK_DONE ? table.getSelectionModel().getSelectedItem() : null;
});
}
示例6: updateItem
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
@Override
protected void updateItem(AgendaEntry item, boolean empty) {
super.updateItem(item, empty);
gridPane.getChildren().clear();
if (item != null) {
LocalDate date = item.getDate();
if (date.equals(agendaView.getToday())) {
if (!headerPane.getStyleClass().contains(AGENDA_VIEW_HEADER_TODAY)) {
headerPane.getStyleClass().add(AGENDA_VIEW_HEADER_TODAY);
dateLabel.getStyleClass().add(AGENDA_VIEW_DATE_LABEL_TODAY);
weekdayLabel.getStyleClass().add(AGENDA_VIEW_WEEKDAY_LABEL_TODAY);
}
} else {
headerPane.getStyleClass().remove(AGENDA_VIEW_HEADER_TODAY);
dateLabel.getStyleClass().remove(AGENDA_VIEW_DATE_LABEL_TODAY);
weekdayLabel.getStyleClass().remove(AGENDA_VIEW_WEEKDAY_LABEL_TODAY);
}
dateLabel.setText(mediumDateFormatter.format(date));
weekdayLabel.setText(weekdayFormatter.format(date));
int count = item.getEntries().size();
int row = 0;
for (int i = 0; i < count; i++) {
Entry<?> entry = item.getEntries().get(i);
Node entryGraphic = createEntryGraphic(entry);
gridPane.add(entryGraphic, 0, row);
Label titleLabel = createEntryTitleLabel(entry);
titleLabel.setMinWidth(0);
gridPane.add(titleLabel, 1, row);
Label timeLabel = createEntryTimeLabel(entry);
timeLabel.setMinWidth(0);
gridPane.add(timeLabel, 2, row);
if (count > 1 && i < count - 1) {
Region separator = new Region();
separator.getStyleClass().add(AGENDA_VIEW_BODY_SEPARATOR); //$NON-NLS-1$
row++;
gridPane.add(separator, 0, row);
GridPane.setColumnSpan(separator, 3);
GridPane.setFillWidth(separator, true);
}
row++;
}
getGraphic().setVisible(true);
} else {
getGraphic().setVisible(false);
}
}
示例7: updateColumns
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void updateColumns() {
pane.getChildren().clear();
final CalendarHeaderView headerView = getSkinnable();
if (headerView.isVisible()) {
Callback<Calendar, Node> factory = headerView.getCellFactory();
List<ColumnConstraints> weekConstraints = new ArrayList<>();
int numberOfDays = headerView.getNumberOfDays();
for (int i = 0; i < numberOfDays; i++) {
ColumnConstraints con = new ColumnConstraints();
con.setPercentWidth((double) 100 / (double) numberOfDays);
weekConstraints.add(con);
GridPane dayGridPane = new GridPane();
dayGridPane.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(dayGridPane, Priority.ALWAYS);
GridPane.setVgrow(dayGridPane, Priority.ALWAYS);
GridPane.setFillHeight(dayGridPane, true);
GridPane.setFillWidth(dayGridPane, true);
List<ColumnConstraints> dayConstraints = new ArrayList<>();
/*
* We only care about visible calendars.
*/
List<Calendar> calendars = headerView.getCalendars().stream()
.filter(headerView::isCalendarVisible)
.collect(Collectors.toList());
int calendarCount = calendars.size();
double columnWidth = (double) 100 / (double) calendarCount;
for (int j = 0; j < calendarCount; j++) {
Calendar calendar = calendars.get(j);
ColumnConstraints calendarConstraint = new ColumnConstraints();
calendarConstraint.setPercentWidth(columnWidth);
calendarConstraint.setFillWidth(true);
calendarConstraint.setHgrow(Priority.ALWAYS);
dayConstraints.add(calendarConstraint);
Node calendarLabel = factory.call(calendar);
calendarLabel.getStyleClass().addAll(
"default-style-calendar-header", //$NON-NLS-1$
calendar.getStyle() + "-calendar-header"); //$NON-NLS-1$
dayGridPane.add(calendarLabel, j, 0);
GridPane.setHgrow(calendarLabel, Priority.ALWAYS);
GridPane.setVgrow(calendarLabel, Priority.ALWAYS);
GridPane.setFillHeight(calendarLabel, true);
GridPane.setFillWidth(calendarLabel, true);
calendarLabel.pseudoClassStateChanged(FIRST_COLUMN, j == 0);
calendarLabel.pseudoClassStateChanged(MIDDLE_COLUMN,
j > 0 && j < calendarCount - 1);
calendarLabel.pseudoClassStateChanged(LAST_COLUMN,
j == calendarCount - 1);
}
dayGridPane.getColumnConstraints().setAll(dayConstraints);
pane.add(dayGridPane, i, 0);
}
pane.getColumnConstraints().setAll(weekConstraints);
}
}
示例8: nodeSelector
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void nodeSelector() {
weightGrid.getChildren().clear();
edgesGrid.getChildren().clear();
label.setText("Select adjacent vertices of '" + vertexValue[counter] + "' and input weight: ");
vertexGrid.getChildren().clear();
Label vertexLabel[] = new Label[steps];
Pane vPane[] = new Pane[steps];
edges = new JFXTextField[steps];
for (int i = 0; i < steps; i++) {
vertexLabel[i] = new Label();
vPane[i] = new Pane();
edges[i] = new JFXTextField();
vertexGrid.add(vPane[i], i, 0);
vertexLabel[i].setAlignment(Pos.CENTER);
vertexLabel[i].setText(vertexValue[i]);
//selector is initialized in initialize() and
//will help to select adjacent nodes
GridPane.setFillHeight(selectors[i], true);
GridPane.setFillWidth(selectors[i], true);
selectors[i].setText(vertexValue[i]);
selectors[i].setTextFill(Color.WHITE);
selectors[i].setStyle("-fx-background-color: " + colors[i]
+ "; -fx-border-color: #000000;"
+ " -fx-background-radius: 10 10 10 10;"
+ "; -fx-border-radius: 10 10 10 10;");
selectors[i].setPrefSize(100, 100);
edgesGrid.add(selectors[i], i, 0);
GridPane.setHalignment(vertexLabel[i], HPos.CENTER);
if (i == counter) {
selectors[i].setDisable(true);
vertexLabel[i].setTextFill(Color.WHITE);
vPane[i].setStyle("-fx-background-color: " + colors[i]
+ "; -fx-border-color: #000000;"
+ " -fx-background-radius: 10 10 10 10;"
+ "; -fx-border-radius: 10 10 10 10;");
} else {
vertexLabel[i].setTextFill(Color.BLACK);
vPane[i].setStyle("-fx-background-color: #B2DFDB; -fx-border-color: #000000;");
selectors[i].setDisable(false);
}
//This portion gonna add the edges fields
edges[i].setFocusColor(Color.web("1A237E"));
edges[i].setUnFocusColor(Color.web("#4d4d4d"));
edges[i].setText("∞");
if (i == counter) {
edges[i].setText("0");
}
edges[i].setAlignment(Pos.CENTER);
edges[i].setDisable(true);
weightGrid.add(edges[i], i, 0);
vertexGrid.add(vertexLabel[i], i, 0);
}
// counter++;
}