本文整理汇总了Java中javafx.geometry.HPos.CENTER属性的典型用法代码示例。如果您正苦于以下问题:Java HPos.CENTER属性的具体用法?Java HPos.CENTER怎么用?Java HPos.CENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.geometry.HPos
的用法示例。
在下文中一共展示了HPos.CENTER属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HistoryListPopup
public HistoryListPopup(@Nullable String popupTitle, @NotNull HistoryListProvider provider) {
super(ArmaDialogCreator.getPrimaryStage(), new VBox(5), popupTitle);
this.provider = provider;
myRootElement.setPadding(new Insets(10));
final ScrollPane scrollPane = new ScrollPane(stackPaneWrapper);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
scrollPane.setFitToHeight(true);
scrollPane.setFitToWidth(true);
scrollPane.setStyle("-fx-background-color:transparent");
myRootElement.getChildren().addAll(scrollPane, new Separator(Orientation.HORIZONTAL), getBoundResponseFooter(false, true, false));
gridPaneContent.setVgap(15);
gridPaneContent.setHgap(5);
ColumnConstraints constraints = new ColumnConstraints(-1, -1, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true);
gridPaneContent.getColumnConstraints().addAll(constraints, constraints);
myStage.setMinWidth(320);
myStage.setMinHeight(320);
myStage.setWidth(480);
stackPaneWrapper.setPrefHeight(320);
fillContent();
}
示例2: alignmentToHPos
/**
* Converts the given horizontal alignment to {@link HPos}.
*
* @param pHorizontalAlignment the horizontal alignment.
* @param pDefaultValue the default value to use.
* @return the appropriate {@link HPos}, or the given default value.
*/
public static HPos alignmentToHPos(int pHorizontalAlignment, HPos pDefaultValue)
{
switch (pHorizontalAlignment)
{
case IAlignmentConstants.ALIGN_LEFT:
return HPos.LEFT;
case IAlignmentConstants.ALIGN_CENTER:
return HPos.CENTER;
case IAlignmentConstants.ALIGN_RIGHT:
return HPos.RIGHT;
default:
return pDefaultValue;
}
}
示例3: setupConstraints
private void setupConstraints() {
final ColumnConstraints c1 = new ColumnConstraints(0.0, 0.0, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true);
final ColumnConstraints c2 = new ColumnConstraints(0.0, USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, Priority.NEVER, HPos.RIGHT, false);
final RowConstraints r1 = new RowConstraints(0.0, 0.0, Double.MAX_VALUE, Priority.ALWAYS, VPos.CENTER, true);
final RowConstraints r2 = new RowConstraints(0.0, USE_COMPUTED_SIZE, USE_COMPUTED_SIZE, Priority.NEVER, VPos.BOTTOM, false);
getColumnConstraints().addAll(c1, c2);
getRowConstraints().addAll(r1, r2);
GridPane.setConstraints(contentPane, 0, 0);
GridPane.setConstraints(hscroll, 0, 1);
GridPane.setConstraints(vscroll, 1, 0);
}
示例4: FXButton
/**
* Creates a new instance of {@link FXButton}.
*
* @param pText the text.
* @param pGraphic the graphic node.
*/
public FXButton(String pText, Node pGraphic)
{
super(pText, pGraphic);
relativeHorizontalTextAlignment = new SimpleObjectProperty<>(HPos.CENTER);
relativeHorizontalTextAlignment.addListener(pObservable -> requestLayout());
relativeVerticalTextAlignment = new SimpleObjectProperty<>(VPos.CENTER);
relativeVerticalTextAlignment.addListener(pObservable -> requestLayout());
}
示例5: FXRadioButton
/**
* Creates a new instance of {@link FXRadioButton}.
*
* @param pText the text.
* @param pGraphicNode the graphic node.
*/
public FXRadioButton(String pText, Node pGraphicNode)
{
super(pText);
setGraphic(pGraphicNode);
relativeHorizontalTextAlignment = new SimpleObjectProperty<>(HPos.CENTER);
relativeHorizontalTextAlignment.addListener(pObservable -> requestLayout());
relativeVerticalTextAlignment = new SimpleObjectProperty<>(VPos.CENTER);
relativeVerticalTextAlignment.addListener(pObservable -> requestLayout());
}
示例6: FXCheckBox
/**
* Creates a new instance of {@link FXCheckBox}.
*
* @param pText the text.
* @param pGraphicNode the graphic node.
*/
public FXCheckBox(String pText, Node pGraphicNode)
{
super(pText);
setGraphic(pGraphicNode);
relativeHorizontalTextAlignment = new SimpleObjectProperty<>(HPos.CENTER);
relativeHorizontalTextAlignment.addListener(pObservable -> requestLayout());
relativeVerticalTextAlignment = new SimpleObjectProperty<>(VPos.CENTER);
relativeVerticalTextAlignment.addListener(pObservable -> requestLayout());
}
示例7: FXFluidFlowPane
/**
* Creates a new instance of {@link FXFluidFlowPane}.
*/
public FXFluidFlowPane()
{
super();
proxy = new OrientationProxy();
alignment = new SimpleObjectProperty<>(Pos.CENTER);
alignment.addListener(pAlignmentObservable -> requestLayout());
autoWrap = new SimpleBooleanProperty(true);
autoWrap.addListener(pAutoWrapObservable -> requestLayout());
hGap = new SimpleDoubleProperty(5);
hGap.addListener(pHGapObservable -> requestLayout());
vGap = new SimpleDoubleProperty(5);
vGap.addListener(pVGapObservable -> requestLayout());
inlineHPos = new SimpleObjectProperty<>(HPos.CENTER);
inlineHPos.addListener(pInlineHPosObservable -> requestLayout());
inlineStretch = new SimpleBooleanProperty(false);
inlineStretch.addListener(pInlineStretchObservable -> requestLayout());
inlineVPos = new SimpleObjectProperty<>(VPos.CENTER);
inlineVPos.addListener(pInlineVPosObservable -> requestLayout());
orientation = new SimpleObjectProperty<>(Orientation.HORIZONTAL);
orientation.addListener(pOrientationObservable -> requestLayout());
stretchHorizontal = new SimpleBooleanProperty(false);
stretchHorizontal.addListener(pStretchHorizontalObservable -> requestLayout());
stretchVertical = new SimpleBooleanProperty(false);
stretchVertical.addListener(pStretchVerticalObservable -> requestLayout());
}
示例8: FXToggleButton
/**
* Creates a new instance of {@link FXToggleButton}.
*
* @param pText the text.
* @param pGraphic the graphic node.
*/
public FXToggleButton(String pText, Node pGraphic)
{
super(pText, pGraphic);
relativeHorizontalTextAlignment = new SimpleObjectProperty<>(HPos.CENTER);
relativeHorizontalTextAlignment.addListener(pObservable -> requestLayout());
relativeVerticalTextAlignment = new SimpleObjectProperty<>(VPos.CENTER);
relativeVerticalTextAlignment.addListener(pObservable -> requestLayout());
}
示例9: setLayout
private void setLayout() {
// set layout for this pane
final RowConstraints headerRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // HEADER FOR FULL WEEK
final RowConstraints allDayRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // SINGLE DAY HEADER AND ALL DAY APPOINTMENTS
final RowConstraints calendarRow = new RowConstraints(
150, 500, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // CALENDAR
final ColumnConstraints columnConstraints = new ColumnConstraints(
400, 600, Double.POSITIVE_INFINITY, Priority.SOMETIMES, HPos.LEFT, true); // FULL WIDTH
this.getRowConstraints().addAll(headerRow, allDayRow, calendarRow);
this.getColumnConstraints().add(columnConstraints);
this.getStyleClass().add("weekview");
// create a container for the week header
Pane weekHeaderContainer = new StackPane();
weekHeaderContainer.getStyleClass().add("weekview-header-container");
this.weekHeaderContainer = weekHeaderContainer;
// ScrollPane that contains the DayPane and the TimeAxis
final ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("weekview-scrollpane");
scrollPane.setStyle("-fx-background-color:transparent;"); // remove gray border
scrollPane.setFitToWidth(true);
scrollPane.setFitToHeight(true);
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
// the ScrollPane holds a GridPane with two columns: one for the TimeAxis and one for the calendar
final GridPane scrollPaneContent = new GridPane();
scrollPaneContent.getStyleClass().add("weekview-scrollpane-content");
final ColumnConstraints timeColumn = new ColumnConstraints(
USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE, Priority.ALWAYS, HPos.LEFT, false); // TIME COLUMN
final ColumnConstraints calendarColumn = new ColumnConstraints(
USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, HPos.LEFT, true); // CALENDAR COLUMN
final RowConstraints rowConstraint = new RowConstraints(
USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // FULL HEIGHT
scrollPaneContent.getColumnConstraints().addAll(timeColumn, calendarColumn);
scrollPaneContent.getRowConstraints().addAll(rowConstraint);
scrollPane.setContent(scrollPaneContent);
// create a container for the TimeAxis
Pane timeAxisContainer = new StackPane();
timeAxisContainer.getStyleClass().add("weekview-timeaxis-container");
scrollPaneContent.add(timeAxisContainer, 0, 0);
this.timeAxisContainer = timeAxisContainer;
// set up a GridPane that holds all the DayPanes and a GridPane for the headers and full day appointments
final GridPane dayPaneContainer = new GridPane();
dayPaneContainer.getStyleClass().add("weekview-daypane-container");
final GridPane dayHeaderContainer = new GridPane();
dayHeaderContainer.getStyleClass().add("weekview-day-header-container");
for (int i = 0; i < numberOfDays; i++) {
final ColumnConstraints appointmentsColumn = new ColumnConstraints(
USE_PREF_SIZE, dayPaneMinWidth, Double.POSITIVE_INFINITY, Priority.ALWAYS, HPos.CENTER, true);
dayPaneContainer.getColumnConstraints().add(appointmentsColumn);
dayHeaderContainer.getColumnConstraints().add(appointmentsColumn);
}
final RowConstraints singleDayHeaderRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // PANE FOR A DAILY HEADER
final RowConstraints singleDayAppointmentsRow = new RowConstraints(USE_PREF_SIZE, USE_COMPUTED_SIZE, USE_PREF_SIZE); // PANE FOR ALL DAY APPOINTMENTS
dayHeaderContainer.getRowConstraints().addAll(singleDayHeaderRow, singleDayAppointmentsRow);
timeAxisContainer.widthProperty().addListener(observable -> {
dayHeaderContainer.setPadding(new Insets(0, 17 /*scrollbar*/, 0, timeAxisContainer.getWidth() + 1));
});
final RowConstraints dayPanesRow = new RowConstraints(
USE_PREF_SIZE, USE_COMPUTED_SIZE, Double.POSITIVE_INFINITY, Priority.ALWAYS, VPos.TOP, true); // FULL HEIGHT
dayPaneContainer.getRowConstraints().add(dayPanesRow);
this.dayPanesContainer = dayPaneContainer;
this.dayHeadersContainer = dayHeaderContainer;
scrollPaneContent.add(dayPaneContainer, 1, 0);
// ordering is important:
this.add(scrollPane, 0, 2);
this.add(dayHeaderContainer, 0, 1);
this.add(weekHeaderContainer, 0, 0);
}
示例10: drawNode
@Override
public Node drawNode() {
HBox root = new HBox();
root.setSpacing(spacing);
Separator separator = new Separator();
if (separator.getOrientation() != Orientation.HORIZONTAL) {
reportGetterFailure("vertical_separator.getOrientation()");
}
if (separator.getValignment() != VPos.CENTER) {
reportGetterFailure("separator.getValignment()");
}
if (separator.getHalignment() != HPos.CENTER) {
reportGetterFailure("separator.getHalignment()");
}
layout.apply(separator);
root.getChildren().add(separator);
Separator vertical_separator = new Separator(Orientation.VERTICAL);
if (vertical_separator.getOrientation() != Orientation.VERTICAL) {
reportGetterFailure("vertical_separator.getOrientation()");
}
if (vertical_separator.getValignment() != VPos.CENTER) {
reportGetterFailure("vertical_separator.getValignment()");
}
if (vertical_separator.getHalignment() != HPos.CENTER) {
reportGetterFailure("vertical_separator.getHalignment()");
}
layout.apply(vertical_separator);
root.getChildren().add(vertical_separator);
Separator horizontal_separator = new Separator(Orientation.HORIZONTAL);
if (horizontal_separator.getOrientation() != Orientation.HORIZONTAL) {
reportGetterFailure("horizontal_separator.getOrientation()");
}
if (horizontal_separator.getValignment() != VPos.CENTER) {
reportGetterFailure("horizontal_separator.getValignment()");
}
if (horizontal_separator.getHalignment() != HPos.CENTER) {
reportGetterFailure("horizontal_separator.getHalignment()");
}
layout.apply(horizontal_separator);
root.getChildren().add(horizontal_separator);
return root;
}
示例11: FXImageRegion
/**
* Creates a new instance of {@link FXImageRegion}.
*/
public FXImageRegion()
{
super();
setCache(true);
imageView = new ImageView();
imageView.setPreserveRatio(true);
getChildren().add(imageView);
imageView.imageProperty().addListener(pObservable -> requestLayout());
imageView.preserveRatioProperty().addListener(pObservable -> requestLayout());
horizontalAlignment = new SimpleObjectProperty<>(HPos.CENTER);
horizontalAlignment.addListener(pObservable -> requestLayout());
verticalAlignment = new SimpleObjectProperty<>(VPos.CENTER);
verticalAlignment.addListener(pObservable -> requestLayout());
horizontalStretched = new SimpleBooleanProperty(false);
horizontalStretched.addListener(pObservable -> requestLayout());
verticalStretched = new SimpleBooleanProperty(false);
verticalStretched.addListener(pObservable -> requestLayout());
}