本文整理匯總了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++;
}