本文整理汇总了Java中javafx.scene.layout.ColumnConstraints.setHalignment方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnConstraints.setHalignment方法的具体用法?Java ColumnConstraints.setHalignment怎么用?Java ColumnConstraints.setHalignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.ColumnConstraints
的用法示例。
在下文中一共展示了ColumnConstraints.setHalignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBody
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
/**
* Creates the node used for the body part of each cell.
*
* In this default implementation the body consists of a grid pane with
* three columns. The middle column is used for showing the title of
* calendar entries. This column will get whatever space is left after
* the icon and the time column have used what they need. This means
* that a very long title will automatically be truncated.
*
* @return the body node
*/
protected Node createBody() {
// icon column
ColumnConstraints iconColumn = new ColumnConstraints();
// title column
ColumnConstraints descriptionColumn = new ColumnConstraints();
descriptionColumn.setFillWidth(true);
descriptionColumn.setHgrow(Priority.SOMETIMES);
descriptionColumn.setMinWidth(0);
descriptionColumn.setPrefWidth(0);
// time column
ColumnConstraints timeColumn = new ColumnConstraints();
timeColumn.setHalignment(HPos.RIGHT);
gridPane = new GridPane();
gridPane.setGridLinesVisible(true);
gridPane.setMinWidth(0);
gridPane.setPrefWidth(0);
gridPane.getStyleClass().add(AGENDA_VIEW_BODY);
gridPane.getColumnConstraints().addAll(iconColumn, descriptionColumn, timeColumn);
return gridPane;
}
示例2: updateVisibility
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
private void updateVisibility() {
for (int row = 0; row < 6; row++) {
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setFillHeight(true);
rowConstraints.setMinHeight(Region.USE_PREF_SIZE);
rowConstraints.setMaxHeight(Region.USE_COMPUTED_SIZE);
rowConstraints.setPrefHeight(Region.USE_COMPUTED_SIZE);
rowConstraints.setVgrow(Priority.ALWAYS);
gridPane.getRowConstraints().add(rowConstraints);
}
ColumnConstraints weekColumn = new ColumnConstraints();
weekColumn.setHalignment(HPos.RIGHT);
weekColumn.setMaxWidth(Region.USE_COMPUTED_SIZE);
weekColumn.setMinWidth(Region.USE_PREF_SIZE);
weekColumn.setPrefWidth(Region.USE_COMPUTED_SIZE);
weekColumn.setFillWidth(true);
weekColumn.setHgrow(Priority.NEVER);
gridPane.getColumnConstraints().add(weekColumn);
for (int col = 0; col < 7; col++) {
ColumnConstraints columnConstraints = new ColumnConstraints();
columnConstraints.setHalignment(HPos.CENTER);
columnConstraints.setMaxWidth(Region.USE_COMPUTED_SIZE);
columnConstraints.setMinWidth(Region.USE_PREF_SIZE);
columnConstraints.setPrefWidth(Region.USE_COMPUTED_SIZE);
columnConstraints.setFillWidth(true);
columnConstraints.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().add(columnConstraints);
}
}
示例3: YearViewSkin
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
public YearViewSkin(YearView view) {
super(view);
view.dateProperty().addListener(evt -> updateMonths());
GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("container");
gridPane.setMaxSize(MAX_VALUE, MAX_VALUE);
for (int row = 0; row < 3; row++) {
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setMinHeight(Region.USE_PREF_SIZE);
rowConstraints.setPrefHeight(Region.USE_COMPUTED_SIZE);
rowConstraints.setMaxHeight(Region.USE_COMPUTED_SIZE);
rowConstraints.setVgrow(Priority.ALWAYS);
rowConstraints.setValignment(VPos.CENTER);
gridPane.getRowConstraints().add(rowConstraints);
}
for (int col = 0; col < 4; col++) {
ColumnConstraints colConstraints = new ColumnConstraints();
colConstraints.setMinWidth(Region.USE_PREF_SIZE);
colConstraints.setPrefWidth(Region.USE_COMPUTED_SIZE);
colConstraints.setMaxWidth(Region.USE_COMPUTED_SIZE);
colConstraints.setHgrow(Priority.ALWAYS);
colConstraints.setHalignment(HPos.CENTER);
gridPane.getColumnConstraints().add(colConstraints);
}
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 4; col++) {
Month month = Month.of(row * 4 + col + 1);
YearMonthView yearMonthView = view.getMonthView(month);
yearMonthView.setShowMonthArrows(false);
yearMonthView.setShowTodayButton(false);
yearMonthView.setShowUsageColors(true);
yearMonthView.setClickBehaviour(YearMonthView.ClickBehaviour.SHOW_DETAILS);
gridPane.add(yearMonthView, col, row);
// do not bind date, we manage it manually
view.bind(yearMonthView, false);
}
}
getChildren().add(gridPane);
updateMonths();
}
示例4: newColumn
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
public static ColumnConstraints newColumn(int value, String unit, HPos position) {
ColumnConstraints col = new ColumnConstraints();
if (unit.equals("%")) {
col.setPercentWidth(value);
}
if (unit.equals("px")) {
col.setMaxWidth(value);
col.setMinWidth(value);
}
if (position != null) {
col.setHalignment(position);
}
return col;
}
示例5: applyColumnConstraints
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override protected void applyColumnConstraints() {
ColumnConstraints buildNumberColumn = new ColumnConstraints();
buildNumberColumn.setPercentWidth( BUILD_PROPERTY_PERCENTAGE );
buildNumberColumn.setHalignment( HPos.LEFT );
ColumnConstraints jobNameColumn = new ColumnConstraints();
jobNameColumn.setPercentWidth( JOB_NAME_PERCENTAGE );
jobNameColumn.setHalignment( HPos.CENTER );
ColumnConstraints completionEstimateColumn = new ColumnConstraints();
completionEstimateColumn.setPercentWidth( COMPLETION_ESTIMATE_PERCENTAGE );
completionEstimateColumn.setHalignment( HPos.RIGHT );
propertiesPane().getColumnConstraints().addAll( buildNumberColumn, jobNameColumn, completionEstimateColumn );
}
示例6: applyColumnConstraints
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override protected void applyColumnConstraints() {
ColumnConstraints buildNumberColumn = new ColumnConstraints();
buildNumberColumn.setPercentWidth( BUILD_PROPERTY_PERCENTAGE );
buildNumberColumn.setHalignment( HPos.LEFT );
ColumnConstraints completionEstimateColumn = new ColumnConstraints();
completionEstimateColumn.setPercentWidth( COMPLETION_ESTIMATE_PERCENTAGE );
completionEstimateColumn.setHalignment( HPos.RIGHT );
propertiesPane().getColumnConstraints().addAll( buildNumberColumn, completionEstimateColumn );
}
示例7: TwoColumnGridPane
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
public TwoColumnGridPane(Double col1Min) {
setGridLinesVisible(Main.DEVELOPMENT_MODE);
setHgap(8);
setVgap(5);
// setPadding(new Insets(5));
ColumnConstraints column1 = new ColumnConstraints();
column1.setMinWidth(col1Min);
column1.setHalignment(HPos.RIGHT);
ColumnConstraints column2 = new ColumnConstraints();
// column2.setPercentWidth(50);
// column1.setHgrow(Priority.ALWAYS);
column2.setHalignment(HPos.CENTER);
// column2.setHgrow(Priority.ALWAYS);
getColumnConstraints().addAll(column1, column2);
}
示例8: ItemGridCellPropertiesPane
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
public ItemGridCellPropertiesPane() {
setHgap(2);
ColumnConstraints column1 = new ColumnConstraints();
column1.setPercentWidth(50);
ColumnConstraints column2 = new ColumnConstraints();
column2.setPercentWidth(50);
column1.setHalignment(HPos.RIGHT);
// column1.setHgrow(Priority.ALWAYS);
column1.setHalignment(HPos.RIGHT);
column2.setHgrow(Priority.ALWAYS);
getColumnConstraints().addAll(column1, column2);
}
示例9: buildTorrentOptionsPane
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
private Node buildTorrentOptionsPane() {
final HBox labelPane = new HBox(5);
labelPane.getChildren().addAll(new Label("Label: "), labelCombo);
labelPane.setAlignment(Pos.CENTER);
HBox.setHgrow(labelCombo, Priority.ALWAYS);
labelCombo.setMaxWidth(Double.MAX_VALUE);
final GridPane torrentOptionsPane = new GridPane();
torrentOptionsPane.setVgap(5);
final ColumnConstraints nameColumnConstraints = new ColumnConstraints(200);
final ColumnConstraints valueColumnConstraints = new ColumnConstraints();
valueColumnConstraints.setFillWidth(true);
valueColumnConstraints.setMaxWidth(Double.MAX_VALUE);
valueColumnConstraints.setHalignment(HPos.LEFT);
torrentOptionsPane.getColumnConstraints().addAll(nameColumnConstraints, valueColumnConstraints);
torrentOptionsPane.add(skipHashCheckbox, 0, 0);
torrentOptionsPane.add(labelPane, 1, 0);
torrentOptionsPane.add(startTorrentCheckbox, 0, 1);
torrentOptionsPane.add(addToTopQueueCheckbox, 1, 1);
GridPane.setHgrow(labelPane, Priority.ALWAYS);
final TitledBorderPane borderedTorrentOptionsPane = new TitledBorderPane("Torrent Options",
torrentOptionsPane, BorderStyle.AMPLE, TitledBorderPane.PRIMARY_BORDER_COLOR_STYLE);
return borderedTorrentOptionsPane;
}
示例10: CandleTooltip
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
CandleTooltip(StringConverter<Number> priceStringConverter) {
this.priceStringConverter = priceStringConverter;
setHgap(Layout.GRID_GAP);
setVgap(2);
Label open = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.open"));
Label close = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.close"));
Label high = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.high"));
Label low = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.low"));
Label average = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.average"));
Label date = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.date"));
setConstraints(open, 0, 0);
setConstraints(openValue, 1, 0);
setConstraints(close, 0, 1);
setConstraints(closeValue, 1, 1);
setConstraints(high, 0, 2);
setConstraints(highValue, 1, 2);
setConstraints(low, 0, 3);
setConstraints(lowValue, 1, 3);
setConstraints(average, 0, 4);
setConstraints(averageValue, 1, 4);
setConstraints(date, 0, 5);
setConstraints(dateValue, 1, 5);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.NEVER);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
getChildren().addAll(open, openValue, close, closeValue, high, highValue, low, lowValue, average, averageValue, date, dateValue);
}
示例11: getColumnConstraints
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
private ColumnConstraints getColumnConstraints(int minWidth,HPos pos) {
ColumnConstraints lastColumn = new ColumnConstraints();
lastColumn.setMinWidth(minWidth);
lastColumn.setHgrow(Priority.SOMETIMES);
lastColumn.setHalignment(pos);
return lastColumn;
}
示例12: prepareRatioGrid
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
/**
* Note that JavaFx GridPane uses (col, row) instead of (row, col)
*/
private void prepareRatioGrid() {
squidSpeciesList = squidProject.getTask().getSquidSpeciesModelList();
indexOfBackgroundSpecies = -1;
ratiosGridPane.getRowConstraints().clear();
RowConstraints rowCon = new RowConstraints();
rowCon.setPrefHeight(BUTTON_HEIGHT);
ratiosGridPane.getRowConstraints().add(rowCon);
ratiosGridPane.getColumnConstraints().clear();
ColumnConstraints colcon = new ColumnConstraints(BUTTON_WIDTH);
colcon.setPrefWidth(BUTTON_WIDTH);
colcon.setHalignment(HPos.CENTER);
ratiosGridPane.getColumnConstraints().add(colcon);
for (int i = 0; i < squidSpeciesList.size(); i++) {
if (squidSpeciesList.get(i).getIsBackground()) {
indexOfBackgroundSpecies = squidSpeciesList.get(i).getMassStationIndex();
squidProject.getTask().setIndexOfBackgroundSpecies(indexOfBackgroundSpecies);
Text colText = new Text(squidSpeciesList.get(i).getIsotopeName());
colText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));
ratiosGridPane.add(colText, 0, i + 1);
Text rowText = new Text(squidSpeciesList.get(i).getIsotopeName());
rowText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));
ratiosGridPane.add(rowText, i + 1, 0);
} else {
Button colButton = new SquidRowColButton(i, -1, squidSpeciesList.get(i).getIsotopeName());
ratiosGridPane.add(colButton, 0, i + 1);
Button rowButton = new SquidRowColButton(-1, i, squidSpeciesList.get(i).getIsotopeName());
ratiosGridPane.add(rowButton, i + 1, 0);
}
Label corLabel = new Label("ROW /\n COL");
corLabel.setFont(Font.font("Courier New", FontWeight.BOLD, 2));
corLabel.setStyle(
" -fx-font-family: \"Courier New\", \"Lucida Sans\", \"Segoe UI\", Helvetica, Arial, sans-serif;\n"
+ " -fx-font-weight: bold;\n"
+ " -fx-font-size: 7pt;\n"
);
corLabel.setWrapText(true);
ratiosGridPane.add(corLabel, 0, 0);
ratiosGridPane.getRowConstraints().add(rowCon);
ratiosGridPane.getColumnConstraints().add(colcon);
}
populateRatioGrid();
// center in window
double width = primaryStageWindow.getScene().getWidth();
ratiosGridPane.setLayoutX((width - (squidSpeciesList.size() + 1) * BUTTON_WIDTH) / 2.0);
ratiosGridPane.setLayoutY(15);
}
示例13: initLayout
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
@Override
public Parent initLayout()
{
BorderPane root = new BorderPane();
root.setMaxWidth(Double.MAX_VALUE);
root.setMaxHeight(Double.MAX_VALUE);
root.setPadding(new Insets(10));
statsPanel.setHgap(10);
statsPanel.setHgap(10);
statsPanel.setPadding(new Insets(10));
int row = 0;
statsPanel.add(this.blocksLabel, 0, row); statsPanel.add(this.blocksValue, 1, row); row++;
statsPanel.add(this.bytesLabel, 0, row); statsPanel.add(this.bytesValue, 1, row); row++;
statsPanel.add(this.percentLabel, 0, row); statsPanel.add(this.percentValue, 1, row);
root.setTop(statsPanel);
imagePanel.setCenter(imageView);
imageView.setSmooth(false);
imageView.fitWidthProperty().bind(imagePanel.widthProperty().subtract(10));
imageView.fitHeightProperty().bind(imagePanel.heightProperty().subtract(10));
root.setCenter(imagePanel);
actionPanel.setHgap(10);
actionPanel.setHgap(10);
actionPanel.setPadding(new Insets(10, 0, 0, 10));
actionPanel.add(this.workValue, 0, 0); actionPanel.add(this.defragButton, 1, 0);
ColumnConstraints c1 = new ColumnConstraints();
c1.setHalignment(HPos.LEFT);
c1.setHgrow(Priority.ALWAYS);
ColumnConstraints c2 = new ColumnConstraints();
c2.setHalignment(HPos.RIGHT);
actionPanel.getColumnConstraints().addAll(c1, c2);
actionPanel.setMaxWidth(Double.MAX_VALUE);
root.setBottom(actionPanel);
BorderPane.setMargin(imagePanel, new Insets(10, 0, 0, 0));
return root;
}
示例14: collectIpCamInfo
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
private void collectIpCamInfo() {
final Stage ipcamStage = new Stage();
final GridPane ipcamPane = new GridPane();
final ColumnConstraints cc = new ColumnConstraints(400);
cc.setHalignment(HPos.CENTER);
ipcamPane.getColumnConstraints().addAll(new ColumnConstraints(), cc);
final TextField nameTextField = new TextField();
ipcamPane.add(new Label("IPCam Name:"), 0, 0);
ipcamPane.add(nameTextField, 1, 0);
final TextField userTextField = new TextField();
userTextField.setPromptText("Optional Username");
ipcamPane.add(new Label("Username:"), 0, 1);
ipcamPane.add(userTextField, 1, 1);
final PasswordField passwordField = new PasswordField();
passwordField.setPromptText("Optional Password");
ipcamPane.add(new Label("Password:"), 0, 2);
ipcamPane.add(passwordField, 1, 2);
final TextField urlTextField = new TextField("http://");
ipcamPane.add(new Label("IPCam URL:"), 0, 3);
ipcamPane.add(urlTextField, 1, 3);
final Button okButton = new Button("OK");
okButton.setDefaultButton(true);
ipcamPane.add(okButton, 1, 4);
okButton.setOnAction((e) -> {
if (nameTextField.getText().isEmpty() || urlTextField.getText().isEmpty()) {
final Alert ipcamInfoAlert = new Alert(AlertType.ERROR);
ipcamInfoAlert.setTitle("Missing Information");
ipcamInfoAlert.setHeaderText("Missing Required IPCam Information!");
ipcamInfoAlert.setResizable(true);
ipcamInfoAlert.setContentText("Please fill in both the IPCam name and the URL.");
ipcamInfoAlert.showAndWait();
return;
}
Optional<String> username = Optional.empty();
Optional<String> password = Optional.empty();
if (!userTextField.getText().isEmpty() || !passwordField.getText().isEmpty()) {
username = Optional.of(userTextField.getText());
password = Optional.of(passwordField.getText());
}
final Optional<Camera> cam = config.registerIpCam(nameTextField.getText(), urlTextField.getText(), username,
password);
if (cam.isPresent()) {
CheckableImageListCell.cacheCamera(cam.get(), PreferencesController.this);
if (!configuredCameras.contains(cam.get())) {
Platform.runLater(() -> {
webcamListView.setItems(null);
cameras.add(cam.get().getName());
webcamListView.setItems(cameras);
});
}
}
ipcamStage.close();
});
final Scene scene = new Scene(ipcamPane);
ipcamStage.initOwner(preferencesPane.getScene().getWindow());
ipcamStage.initModality(Modality.WINDOW_MODAL);
ipcamStage.setTitle("Register IPCam");
ipcamStage.setScene(scene);
ipcamStage.showAndWait();
}
示例15: addSettingControls
import javafx.scene.layout.ColumnConstraints; //导入方法依赖的package包/类
private void addSettingControls() {
final GridPane bouncingTargetsPane = new GridPane();
final ColumnConstraints cc = new ColumnConstraints(100);
cc.setHalignment(HPos.CENTER);
bouncingTargetsPane.getColumnConstraints().addAll(new ColumnConstraints(), cc);
final int MAX_TARGETS = 10;
final int MAX_VELOCITY = 30;
final int SHOOT_DEFAULT_COUNT = 4 - 1;
final int DONT_SHOOT_DEFAULT_COUNT = 1 - 1;
final int DEFAULT_MAX_VELOCITY = 10;
final ObservableList<String> targetCounts = FXCollections.observableArrayList();
for (int i = 1; i <= MAX_TARGETS; i++)
targetCounts.add(Integer.toString(i));
final ComboBox<String> shootTargetsComboBox = new ComboBox<>(targetCounts);
shootTargetsComboBox.getSelectionModel().select(SHOOT_DEFAULT_COUNT);
shootTargetsComboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
shootCount = Integer.parseInt(newValue);
stopExercise();
startExercise();
});
bouncingTargetsPane.add(new Label("Shoot Targets:"), 0, 0);
bouncingTargetsPane.add(shootTargetsComboBox, 1, 0);
final ComboBox<String> dontShootTargetsComboBox = new ComboBox<>(targetCounts);
dontShootTargetsComboBox.getSelectionModel().select(DONT_SHOOT_DEFAULT_COUNT);
dontShootTargetsComboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
dontShootCount = Integer.parseInt(newValue);
stopExercise();
startExercise();
});
bouncingTargetsPane.add(new Label("Don't Shoot Targets:"), 0, 1);
bouncingTargetsPane.add(dontShootTargetsComboBox, 1, 1);
final ObservableList<String> maxVelocity = FXCollections.observableArrayList();
for (int i = 1; i <= MAX_VELOCITY; i++)
maxVelocity.add(Integer.toString(i));
final ComboBox<String> maxVelocityComboBox = new ComboBox<>(maxVelocity);
maxVelocityComboBox.getSelectionModel().select(DEFAULT_MAX_VELOCITY - 1);
maxVelocityComboBox.valueProperty().addListener((observable, oldValue, newValue) -> {
BouncingTargets.maxVelocity = Integer.parseInt(newValue);
stopExercise();
startExercise();
});
bouncingTargetsPane.add(new Label("Max Target Speed:"), 0, 2);
bouncingTargetsPane.add(maxVelocityComboBox, 1, 2);
final CheckBox removeTargets = new CheckBox();
removeTargets.setOnAction((event) -> removeShootTargets = removeTargets.isSelected());
bouncingTargetsPane.add(new Label("Remove Hit Shoot Targets:"), 0, 3);
bouncingTargetsPane.add(removeTargets, 1, 3);
super.addExercisePane(bouncingTargetsPane);
}