本文整理匯總了Java中javafx.scene.layout.GridPane.setColumnSpan方法的典型用法代碼示例。如果您正苦於以下問題:Java GridPane.setColumnSpan方法的具體用法?Java GridPane.setColumnSpan怎麽用?Java GridPane.setColumnSpan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setColumnSpan方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mouseReleased
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
private void mouseReleased(MouseEvent event) {
if (!dragging) {
return;
}
dragging = false;
tile.setCursor(Cursor.DEFAULT);
resizeLocation = ResizeLocation.NONE;
TileSize size = finalSize();
tile.setSize(size);
GridPane.setColumnSpan(tile, size.getWidth());
GridPane.setRowSpan(tile, size.getHeight());
tilePane.setHighlight(false);
ResizeUtils.setCurrentTile(null);
}
示例2: 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);
}
}
示例3: MovieCell
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public MovieCell(MovieView movieView) {
this.movieView = movieView;
GridPane gridPane = new GridPane();
ColumnConstraints col1 = new ColumnConstraints();
ColumnConstraints col2 = new ColumnConstraints();
ColumnConstraints col3 = new ColumnConstraints();
ColumnConstraints col4 = new ColumnConstraints();
ColumnConstraints col5 = new ColumnConstraints();
col4.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().setAll(col1, col2, col3, col4, col5);
gridPane.setHgap(10);
// director image
directorImage = new ImageView();
directorImage.setFitWidth(60);
directorImage.setFitHeight(60);
directorImage.setEffect(new InnerShadow());
gridPane.add(directorImage, 0, 0);
GridPane.setRowSpan(directorImage, 2);
GridPane.setValignment(directorImage, VPos.TOP);
// title and year
titleLabel = new Label();
titleLabel.getStyleClass().add("title-label");
gridPane.add(titleLabel, 1, 0);
GridPane.setColumnSpan(titleLabel, 2);
GridPane.setValignment(titleLabel, VPos.TOP);
// director label
directorLabel = new Label();
directorLabel.getStyleClass().add("director-label");
gridPane.add(directorLabel, 1, 1);
GridPane.setValignment(directorLabel, VPos.TOP);
// genre label
genreLabel = new Label();
genreLabel.getStyleClass().add("genre-label");
gridPane.add(genreLabel, 4, 0);
// trailer label
trailerLabel = FontAwesomeIconFactory.get().createIconLabel(FontAwesomeIcon.FILM, "", "14px", "14px", ContentDisplay.GRAPHIC_ONLY);
trailerLabel.getStyleClass().add("trailer-label");
gridPane.add(trailerLabel, 3, 0);
GridPane.setHalignment(trailerLabel, HPos.LEFT);
GridPane.setValignment(trailerLabel, VPos.TOP);
trailerLabel.setOnMouseClicked(evt -> {
try {
Movie movie = getItem();
movieView.setSelectedTrailer(MovieApp.class.getResource("/trailers/" + movie.getTrailer()).toExternalForm());
} catch (NullPointerException e) {
movieView.setSelectedTrailer(MovieApp.class.getResource("/TrailerMissing.mp4").toExternalForm());
}
});
setGraphic(gridPane);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
movieView.useClippingProperty().addListener(it -> updateClipping());
updateClipping();
}
示例4: initialize
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
@Override public void initialize(URL location, ResourceBundle resources)
{
this.quantityType.getItems().addAll(QuantityType.listOfNames());
// Row actions:
this.activities.setRowFactory(e -> {
TableRow<Activity> row = new TableRow<>();
row.setOnMouseClicked(event -> {
if (!row.isEmpty() && event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2)
{
try
{
MainController.ui.activityDetails(row.getItem());
this.activities.refresh();
} catch (IOException e1)
{
UIManager.reportError("Unable to open View file");
}
}
});
return row;
});
// =================
// Quantity actions:
this.addQuantity.setOnMousePressed(event -> {
if (event.isPrimaryButtonDown())
context.show(addQuantity, event.getScreenX(), event.getScreenY());
});
// =================
// Hide the Activities table:
if (this.requirement == null)
{
this.pane.getChildren().remove(this.activities);
this.pane.getRowConstraints().remove(3);
Node bottomNode = this.pane.getChildren().get(0);
this.pane.getChildren().remove(bottomNode);
this.pane.getRowConstraints().remove(3);
GridPane.setColumnSpan(bottomNode, 2);
this.pane.addRow(3, bottomNode);
}
// =================
else
{
// Disable/modify elements:
this.title.setText("Requirement");
if (this.requirement.isComplete())
this.completed.setVisible(true);
// Activity columns:
nameColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
quantityColumn.setCellValueFactory(new PropertyValueFactory<>("activityQuantity"));
dateColumn.setCellValueFactory(new PropertyValueFactory<>("dateString"));
// =================
// Fill in data:
this.name.setText(this.requirement.getName());
this.details.setText(this.requirement.getDetails().getAsString());
this.time.setText(Double.toString(this.requirement.getEstimatedTimeInHours()));
this.quantity.setText(Integer.toString(this.requirement.getInitialQuantity()));
this.quantityType.getSelectionModel().select(this.requirement.getQuantityType().getName());
this.activities.getItems().addAll(this.requirement.getActivityLog());
// =================
}
// =================
Platform.runLater(() -> this.pane.requestFocus());
}
示例5: addSpecialInstrumentationItem
import javafx.scene.layout.GridPane; //導入方法依賴的package包/類
public static void addSpecialInstrumentationItem(int id, KeyValuePair sectionType, KeyValuePair specialInstrumentation, int specialInstrumentationCount,
List<SpecialInstrumentationEntity> specialInstrumentationEntityList, GridPane specialInstrumentationContent,
ComboBox<KeyValuePair> specialInstrumentationSectionGroupComboBox, NumberField specialInstrumentationNumberField) {
GridPane tmpPane = new GridPane();
ComboBox<KeyValuePair> sectionTypeComboBox = new ComboBox<>(specialInstrumentationSectionGroupComboBox.getItems());
sectionTypeComboBox.getSelectionModel().select(sectionType);
sectionTypeComboBox.setMaxWidth(100);
sectionTypeComboBox.setMinWidth(100);
tmpPane.addColumn(0, sectionTypeComboBox);
ComboBox<KeyValuePair> specialInstrumentationComboBox = new ComboBox<>(TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().getSelectedItem().getValue()));
specialInstrumentationComboBox.getSelectionModel().selectFirst();
specialInstrumentationComboBox.setMaxWidth(100);
specialInstrumentationComboBox.setMinWidth(100);
tmpPane.addColumn(1, specialInstrumentationComboBox);
NumberField tmpNumberField = null;
try {
tmpNumberField = new NumberField(specialInstrumentationCount, specialInstrumentationNumberField.getMinValue().intValue(), specialInstrumentationNumberField.getMaxValue().intValue());
tmpPane.addColumn(2, tmpNumberField);
tmpNumberField.setMaxWidth(60);
tmpNumberField.setStyle("-fx-opacity: 1");
} catch (NumberRangeException e) {
}
sectionTypeComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
if(((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
getSelectedItem().getValue())))!=null) {
specialInstrumentationComboBox.setItems((TeamF.client.helper.gui.InstrumentationHelper.getInstrumentTypes((SectionGroupType) sectionTypeComboBox.getSelectionModel().
getSelectedItem().getValue())));
specialInstrumentationComboBox.getSelectionModel().selectFirst();
}
}
});
Button tmpButton = new Button("-");
tmpPane.addColumn(3, tmpButton);
specialInstrumentationContent.addRow(specialInstrumentationEntityList.size()+1, tmpPane);
specialInstrumentationContent.setColumnSpan(tmpPane, 4);
SpecialInstrumentationEntity specialInstrumentationEntity = new SpecialInstrumentationEntity(id, sectionTypeComboBox, specialInstrumentationComboBox, tmpNumberField, tmpPane);
tmpButton.setOnAction(e -> removeSpecialInstrumentationItem(specialInstrumentationEntity, specialInstrumentationContent, specialInstrumentationEntityList));
specialInstrumentationEntityList.add(specialInstrumentationEntity);
}