本文整理汇总了Java中javafx.scene.layout.GridPane.setValignment方法的典型用法代码示例。如果您正苦于以下问题:Java GridPane.setValignment方法的具体用法?Java GridPane.setValignment怎么用?Java GridPane.setValignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.GridPane
的用法示例。
在下文中一共展示了GridPane.setValignment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFormField
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public FormPane addFormField(String text, Node... fields) {
Label label = new Label(text);
String labelId = idText(text);
label.setId(labelId);
GridPane.setValignment(label, VPos.TOP);
int column = 0;
add(label, column++, currentRow, 1, 1);
int colspan = columns - fields.length;
int fieldIndex = 1;
for (Node field : fields) {
field.setId(labelId + "-field-" + fieldIndex);
setFormConstraints(field);
GridPane.setValignment(field, VPos.TOP);
add(field, column++, currentRow, colspan, 1);
fieldIndex++;
}
currentRow++;
column = 0;
return this;
}
示例2: GoogleEntryDetailsView
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public GoogleEntryDetailsView(GoogleEntry entry) {
super(requireNonNull(entry));
this.entry = entry;
Label notificationLabel = new Label("Notification:");
Label addButton = new Label("Add a notification");
addButton.getStyleClass().add("link");
addButton.setOnMouseClicked(evt -> createReminder());
addButton.disableProperty().bind(entry.getCalendar().readOnlyProperty());
VBox center = new VBox();
BorderPane notificationPane = new BorderPane();
notificationPane.setCenter(center);
notificationPane.setBottom(addButton);
GridPane box = (GridPane) getChildren().get(0);
box.add(notificationLabel, 0, 5);
box.add(notificationPane, 1, 5);
GridPane.setValignment(notificationLabel, VPos.TOP);
getStyleClass().add("details-view");
if (entry.isUseDefaultReminder()) {
GoogleCalendar calendar = (GoogleCalendar) entry.getCalendar();
reminders.addAll(calendar.getDefaultReminders());
}
reminders.addAll(entry.getReminders());
reminders.addListener((Observable obs) -> buildItems(center));
buildItems(center);
}
示例3: setupView
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void setupView() {
ImageView weatherIcon = new ImageView();
weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
GridPane.setHalignment(weatherIcon, HPos.CENTER);
GridPane.setValignment(weatherIcon, VPos.CENTER);
add(weatherIcon, 0, 0);
Text txt_weather_event = new Text();
txt_weather_event.setText(controller.getWeatherEventText());
GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
GridPane.setValignment(txt_weather_event, VPos.CENTER);
add(txt_weather_event, 1, 0);
}
示例4: addRow
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private static int addRow(String name, Node content, GridPane grid, int row) {
Label label = new Label(name+":");
label.setMinWidth(Label.USE_PREF_SIZE);
grid.add(label, 0, row);
GridPane.setValignment(label, VPos.TOP);
grid.add(content, 1, row);
return row + 1;
}
示例5: init
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
* Initialize view
*/
@Override
public void init (List<ISubFormView> subFormViews) {
this.myFormView = new FormView(subFormViews);
myCreationPane.setAlignment(Pos.TOP_LEFT);
GridPane.setValignment(myCreationListView.draw(), VPos.TOP);
myCreationPane.add(myCreationListView.draw(), 0, 0);
myCreationPane.add(myFormView.draw(), 1, 0);
// myCreationPane.getStyleClass().add("myCreationView");
}
示例6: initPlayer1Button
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public void initPlayer1Button() {
inventoryPlayer1.getChildren().remove(0, inventoryPlayer1.getChildren().size());
List<Piece> inventory = core.getPlayers()[0].getInventory();
int line = 0;
int col = 0;
for (int i = 0; i < inventory.size(); i++) {
Piece piece = inventory.get(i);
ToggleButton b = new ToggleButton();
b.setMinSize(65, 65);
b.setBackground(new Background(new BackgroundFill(new ImagePattern(piece.getImage()), CornerRadii.EMPTY, Insets.EMPTY)));
if (core.getCurrentPlayer() == Consts.PLAYER1 && core.getState() == Consts.WAIT_FOR_INPUT) {
b.setOnMouseClicked(new ControllerButtonPiece(this,inventory.get(i).getId(), i));
//eventDragAndDropPiece(b,inventory.get(i).getId());
b.getStyleClass().add("buttonInventory");
b.setCursor(Cursor.HAND);
b.setTooltip(new Tooltip(inventory.get(i).getDescription()));
inventoryGroup.getToggles().add(b);
}
b.disableProperty().bind(animationPlaying);
if (i != 0 && i % 4 == 0) {
col = 0;
line++;
}
GridPane.setConstraints(b, col, line);
GridPane.setHalignment(b, HPos.CENTER);
GridPane.setValignment(b, VPos.TOP);
inventoryPlayer1.getChildren().add(b);
col++;
}
}
示例7: initPlayer2Button
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
public void initPlayer2Button() {
inventoryPlayer2.getChildren().remove(0, inventoryPlayer2.getChildren().size());
List<Piece> inventory = core.getPlayers()[1].getInventory();
int line = 0;
int col = 0;
for (int i = 0; i < inventory.size(); i++) {
Piece piece = inventory.get(i);
ToggleButton b = new ToggleButton();
b.setMinSize(65, 65);
b.setBackground(new Background(new BackgroundFill(new ImagePattern(piece.getImage()), CornerRadii.EMPTY, Insets.EMPTY)));
if (core.getCurrentPlayer() == Consts.PLAYER2 && core.getState() == Consts.WAIT_FOR_INPUT) {
b.setOnMouseClicked(new ControllerButtonPiece(this,inventory.get(i).getId(), i));
b.getStyleClass().add("buttonInventory");
b.setCursor(Cursor.HAND);
b.setTooltip(new Tooltip(inventory.get(i).getDescription()));
inventoryGroup.getToggles().add(b);
}
b.disableProperty().bind(animationPlaying);
if (i != 0 && i % 4 == 0) {
col = 0;
line++;
}
GridPane.setConstraints(b, col, line);
GridPane.setHalignment(b, HPos.CENTER);
GridPane.setValignment(b, VPos.TOP);
inventoryPlayer2.getChildren().add(b);
col++;
}
}
示例8: addGuiElements
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
private void addGuiElements() {
if (controller.getWeatherBackgroundClass() != null) {
gridPane.setId(controller.getWeatherBackgroundClass());
}
weatherIconView = new ImageView(controller.getWeatherIcon() != null ?
controller.getWeatherIcon() : fileLoad.loadImageFile(NO_IMAGE_LOCATION));
weatherIconView.fitWidthProperty().bind(stage.widthProperty().divide(3));
weatherIconView.fitHeightProperty().bind(stage.heightProperty().divide(2));
GridPane.setHgrow(weatherIconView, Priority.ALWAYS);
GridPane.setHalignment(weatherIconView, HPos.CENTER);
GridPane.setVgrow(weatherIconView, Priority.ALWAYS);
GridPane.setValignment(weatherIconView, VPos.CENTER);
gridPane.add(weatherIconView, 0, 0);
GridPane gridPane_conditions = new GridPane();
gridPane_conditions.setHgap(10);
gridPane_conditions.setVgap(10);
GridPane.setHgrow(gridPane_conditions, Priority.ALWAYS);
GridPane.setHalignment(gridPane_conditions, HPos.CENTER);
GridPane.setVgrow(gridPane_conditions, Priority.ALWAYS);
GridPane.setValignment(gridPane_conditions, VPos.TOP);
gridPane.add(gridPane_conditions, 1, 0);
txt_temperature = new Text();
txt_temperature.setText(controller.getCurrentWeatherTemperatureText());
txt_temperature.setFont(new Font(48));
txt_temperature.setStyle("-fx-font-weight: bold");
GridPane.setHgrow(txt_temperature, Priority.ALWAYS);
GridPane.setHalignment(txt_temperature, HPos.LEFT);
GridPane.setVgrow(txt_temperature, Priority.ALWAYS);
GridPane.setValignment(txt_temperature, VPos.TOP);
gridPane_conditions.add(txt_temperature, 0, 0);
txt_condition = new Text();
txt_condition.setText(controller.getCurrentWeatherConditionText());
txt_condition.setFont(new Font(24));
GridPane.setHgrow(txt_condition, Priority.ALWAYS);
GridPane.setHalignment(txt_condition, HPos.LEFT);
GridPane.setVgrow(txt_condition, Priority.ALWAYS);
GridPane.setValignment(txt_condition, VPos.TOP);
gridPane_conditions.add(txt_condition, 0, 1);
btn_edit_settings = new Button();
ImageView imgView = new ImageView(fileLoad.loadImageFile(EDIT_ICON_LOCATION));
btn_edit_settings.setGraphic(imgView);
GridPane.setHgrow(btn_edit_settings, Priority.ALWAYS);
GridPane.setHalignment(btn_edit_settings, HPos.RIGHT);
GridPane.setVgrow(btn_edit_settings, Priority.ALWAYS);
GridPane.setValignment(btn_edit_settings, VPos.TOP);
gridPane.add(btn_edit_settings, 2, 0);
btn_edit_settings.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
SettingsPage settingsPage = new SettingsPage(gridPane, stage);
stage.getScene().setRoot(settingsPage.getRootPane());
}
});
ForecastsPane gridPane_forecasts = new ForecastsPane(stage);
GridPane.setHgrow(gridPane_forecasts, Priority.ALWAYS);
GridPane.setHalignment(gridPane_forecasts, HPos.CENTER);
gridPane.add(gridPane_forecasts, 0, 1, 3, 1);
}
示例9: 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();
}
示例10: setAlignments
import javafx.scene.layout.GridPane; //导入方法依赖的package包/类
/**
* Sets the alignments for the children of the grid pane
* @param heading The heading child.
* @param instructions The instructions child.
* @param closeButton The closeButton child.
*/
private void setAlignments(Node heading, Node instructions, Node closeButton) {
GridPane.setHalignment(heading, HPos.CENTER);
GridPane.setValignment(heading, VPos.CENTER);
GridPane.setHalignment(closeButton, HPos.RIGHT);
}