java类javafx.geometry.HPos的实例源码

Sample.java 文件源码 项目:marathonv5 阅读 30 收藏 0 点赞 0 评论 0
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
Sample.java 文件源码 项目:marathonv5 阅读 24 收藏 0 点赞 0 评论 0
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
WizardStepBuilder.java 文件源码 项目:MineIDE 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Add a yes/no choice to a wizard step.
 *
 * @param fieldName
 * @param defaultValue
 *            of the choice.
 * @param prompt
 *            the tooltip to show
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addBoolean(final String fieldName, final boolean defaultValue, final String prompt)
{
    final JFXCheckBox box = new JFXCheckBox();
    box.setTooltip(new Tooltip(prompt));
    box.setSelected(defaultValue);

    this.current.getData().put(fieldName, new SimpleBooleanProperty());
    this.current.getData().get(fieldName).bind(box.selectedProperty());

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(box, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
WizardStepBuilder.java 文件源码 项目:MineIDE 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Add an enumeration of options to a wizard step.
 *
 * @param fieldName
 * @param defaultValue
 *            is the index of the value in your options array. Can be set <
 *            0 to empty the combobox as default.
 * @param prompt
 *            the tooltip to show
 * @param options
 *            your array of options, use a {@link IconLabel} object to add
 *            icons to your options. Only the text will be selected.
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addEnum(final String fieldName, final int defaultValue, final String prompt,
        final IconLabel... options)
{
    final JFXComboBox<IconLabel> jfxCombo = new JFXComboBox<>();

    jfxCombo.getItems().addAll(options);
    jfxCombo.setPromptText(prompt);

    if (defaultValue < 0)
        jfxCombo.setValue(new IconLabel(null, ""));
    else
        jfxCombo.setValue(options[defaultValue]);

    this.current.getData().put(fieldName, new SimpleObjectProperty<IconLabel>());
    this.current.getData().get(fieldName).bind(jfxCombo.valueProperty());

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(jfxCombo, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(jfxCombo, 1, this.current.getData().size() - 1);
    return this;
}
WizardStepBuilder.java 文件源码 项目:MineIDE 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Add a large String to a wizard step. A TextArea will be used to represent
 * it.
 *
 * @param fieldName
 * @param defaultValue
 *            the default String the textfield will contains.
 * @param prompt
 *            the text to show on the textfield prompt String.
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addBigString(final String fieldName, final String defaultValue, final String prompt)
{
    final JFXTextArea text = new JFXTextArea();
    text.setPromptText(prompt);
    text.setText(defaultValue);
    this.current.getData().put(fieldName, new SimpleStringProperty());
    this.current.getData().get(fieldName).bind(text.textProperty());
    text.setMaxWidth(400);

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(text, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(text, 1, this.current.getData().size() - 1);
    return this;
}
ConfigurationView.java 文件源码 项目:wall-t 阅读 28 收藏 0 点赞 0 评论 0
private GridPane serverConfigurationPane( ) {
    final GridPane grid = new GridPane( );
    grid.setAlignment( Pos.CENTER );
    grid.setPadding( new Insets( 10 ) );
    grid.setHgap( 10 );
    grid.setVgap( 20 );

    serverUrlLine( grid );
    credentialsLine( grid );
    apiVersionLine( grid );
    proxyConfigurationLine( grid );

    final ColumnConstraints noConstraint = new ColumnConstraints( );
    final ColumnConstraints rightAlignementConstraint = new ColumnConstraints( );
    rightAlignementConstraint.setHalignment( HPos.RIGHT );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );

    grid.setStyle( "-fx-border-color:white; -fx-border-radius:5;" );

    return grid;
}
ConfigurationView.java 文件源码 项目:wall-t 阅读 23 收藏 0 点赞 0 评论 0
private GridPane preferenceConfigurationPane( ) {
    final GridPane grid = new GridPane( );
    grid.setAlignment( Pos.CENTER );
    grid.setPadding( new Insets( 10 ) );
    grid.setHgap( 10 );
    grid.setVgap( 20 );

    lightModeCheckBox( grid );
    nbTilesByColumnComboBox( grid );
    nbTilesByRowComboBox( grid );

    final ColumnConstraints noConstraint = new ColumnConstraints( );
    final ColumnConstraints rightAlignementConstraint = new ColumnConstraints( );
    rightAlignementConstraint.setHalignment( HPos.RIGHT );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );

    grid.setStyle( "-fx-border-color:white; -fx-border-radius:5;" );

    return grid;
}
PermissionsDialog.java 文件源码 项目:campingsimulator2017 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Create a row with text and radio buttons
 * @param name of the row
 * @param i iterator
 */
private void add_row(String name, int i){
    Text text = new Text(name);
    text.setStyle("-fx-font-weight: bold;" +
            "-fx-font-size: 17px");
    text.setFill(Color.WHITESMOKE);
    gridPane.add(text, 0, i+1);

    RadioButton readButton = new RadioButton();
    GridPane.setHalignment(readButton, HPos.CENTER);
    gridPane.add(readButton, 1,i+1);

    RadioButton editButton = new RadioButton();
    GridPane.setHalignment(editButton, HPos.CENTER);
    gridPane.add(editButton, 2, i+1);

    editButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            readButton.setSelected(true);
        }
    });

    radioButtonArrayList.add(readButton);
    radioButtonArrayList.add(editButton);
}
ProxyModal.java 文件源码 项目:x-facteur 阅读 19 收藏 0 点赞 0 评论 0
protected GridPane content() {
    gridP.setHgap(8);
    gridP.setVgap(6);
    gridP.setPadding(new Insets(10, 20, 12, 20));
    gridP.add(header, 0, 0, 2, 1);
    gridP.add(useProxyL, 0, 1);
    gridP.add(useProxy, 1, 1);
    gridP.add(hostL, 0, 2);
    gridP.add(host, 1, 2, 2, 1);
    gridP.add(portL, 0, 3);
    gridP.add(port, 1, 3, 2, 1);
    GridPane.setHalignment(okBtn, HPos.RIGHT);
    GridPane.setHalignment(cancelBtn, HPos.RIGHT);
    okBtn.setPrefWidth(80);
    cancelBtn.setPrefWidth(80);
    gridP.add(okBtn, 1, 4);
    gridP.add(cancelBtn, 2, 4);

    return gridP;
}
MailmanEditModal.java 文件源码 项目:x-facteur 阅读 45 收藏 0 点赞 0 评论 0
protected GridPane content() {
    gridP.setHgap(8);
    gridP.setVgap(6);
    gridP.setPadding(new Insets(10, 20, 12, 20));
    gridP.add(header, 0, 0, 2, 1);
    gridP.add(mailmanNameL, 0, 2);
    gridP.add(mailmanName, 1, 2, 2, 1);
    gridP.add(mailmanLastNameL, 0, 1);
    gridP.add(mailmanLastName, 1, 1, 2, 1);
    gridP.add(driverL, 0, 3);
    gridP.add(driver, 1, 3);
    GridPane.setHalignment(okBtn, HPos.RIGHT);
    GridPane.setHalignment(cancelBtn, HPos.RIGHT);
    okBtn.setPrefWidth(80);
    cancelBtn.setPrefWidth(80);
    gridP.add(okBtn, 1, 4);
    gridP.add(cancelBtn, 2, 4);

    return gridP;
}
ShipmentEditModal.java 文件源码 项目:x-facteur 阅读 18 收藏 0 点赞 0 评论 0
protected GridPane content() {
    gridP.setHgap(8);
    gridP.setVgap(6);
    gridP.setPadding(new Insets(10, 20, 12, 20));
    gridP.add(header, 0, 0, 2, 1);
    gridP.add(addressStreetL, 0, 1);
    gridP.add(addressStreet, 1, 1, 2, 1);
    gridP.add(addressCityL, 0, 2);
    gridP.add(addressCity, 1, 2, 2, 1);
    gridP.add(drivenL, 0, 3);
    gridP.add(driven, 1, 3);
    GridPane.setHalignment(okBtn, HPos.RIGHT);
    GridPane.setHalignment(cancelBtn, HPos.RIGHT);
    okBtn.setPrefWidth(80);
    cancelBtn.setPrefWidth(80);
    gridP.add(okBtn, 1, 4);
    gridP.add(cancelBtn, 2, 4);

    return gridP;
}
AgendaView.java 文件源码 项目:CalendarFX 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 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;
}
NotificationPane.java 文件源码 项目:WeatherWatch 阅读 22 收藏 0 点赞 0 评论 0
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);
}
DateChooserSkin.java 文件源码 项目:Gargoyle 阅读 22 收藏 0 点赞 0 评论 0
@Override
protected void layoutChildren() {
    ObservableList<Node> children = getChildren();
    double width = getWidth();
    double height = getHeight();

    double cellWidth = (width / (columns + 1));
    double cellHeight = height / (rows + 1);

    for (int i = 0; i < (rows + 1); i++) {
        for (int j = 0; j < (columns + 1); j++) {
            if (children.size() <= ((i * (columns + 1)) + j)) {
                break;
            }
            Node get = children.get((i * (columns + 1)) + j);
            layoutInArea(get, j * cellWidth, i * cellHeight, cellWidth, cellHeight, 0.0d, HPos.LEFT, VPos.TOP);
        }

    }
}
ImageViewPane.java 文件源码 项目:Gargoyle 阅读 25 收藏 0 点赞 0 评论 0
@Override
protected void layoutChildren() {
    ImageView imageView = imageViewProperty.get();
    if (imageView != null) {
        double width = getWidth();
        double height = getHeight();
        if (width > height) {
            width = 5 / 3 * height;
        }

        double x = this.getPrefWidth() / 3.3 ;

        imageView.setFitWidth(width);
        imageView.setFitHeight(height);
        layoutInArea(imageView, x , 0, getWidth(), getHeight(), 0, HPos.CENTER, VPos.CENTER);
    }
     super.layoutChildren();
}
HistoryListPopup.java 文件源码 项目:arma-dialog-creator 阅读 24 收藏 0 点赞 0 评论 0
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();
}
LayoutTableViewApp.java 文件源码 项目:openjfx-8u-dev-tests 阅读 34 收藏 0 点赞 0 评论 0
@Override
public Node drawNode() {
    pane = baseFill(new FlowPane());
    pane.setHgap(10);
    if (pane.getHgap() != 10) {
        reportGetterFailure("FlowPane.getHgap()");
    }

    pane.setColumnHalignment(HPos.LEFT);
    pane.setRowValignment(VPos.TOP);
    pane.setAlignment(Pos.BOTTOM_LEFT);//.setVpos(VPos.BOTTOM);
    if (pane.getAlignment() != Pos.BOTTOM_LEFT) {
        reportGetterFailure("FlowPane.getAlignment()");
    }

    return pane;
}
SeparatorApp.java 文件源码 项目:openjfx-8u-dev-tests 阅读 23 收藏 0 点赞 0 评论 0
@Override
public Node drawNode() {
    HBox root = new HBox();
    root.setSpacing(spacing);
    for (HPos pos : HPos.values()) {
        Separator separator = getSeparator();
        separator.setHalignment(pos);
        if (separator.getHalignment() != pos) {
            reportGetterFailure("separator.setHalignment()");
        }
        VBox box = new VBox();
        box.getChildren().addAll(new Label("[" + pos.name() + "]"), separator);
        root.getChildren().add(box);
    }
    return root;
}
Layout2App.java 文件源码 项目:openjfx-8u-dev-tests 阅读 22 收藏 0 点赞 0 评论 0
@Override
public Node drawNode() {
    pane = baseFill(new FlowPane());
    pane.setHgap(10);
    if (pane.getHgap() != 10) {
        reportGetterFailure("FlowPane.getHgap()");
    }

    pane.setColumnHalignment(HPos.LEFT);
    pane.setRowValignment(VPos.TOP);
    pane.setAlignment(Pos.BOTTOM_LEFT);//.setVpos(VPos.BOTTOM);
    if (pane.getAlignment() != Pos.BOTTOM_LEFT) {
        reportGetterFailure("FlowPane.getAlignment()");
    }

    return pane;
}
global.java 文件源码 项目:sudoku-desktop-game 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Initialize button styles, icons sizes Muhammad Tarek
 * 
 * @param button
 * @param layout
 * @param position
 * @param icon
 */
static void initButtonStyle(Button button, GridPane layout, int position, ImageView icon, int bgColor) {
    button.getStyleClass().add("icon-text-button");

    if (icon != null) {
        icon.setFitHeight(bgColor == 1 ? 20 : 24);
        icon.setFitWidth(bgColor == 1 ? 20 : 24);
    }

    button.getStyleClass().add("button-icon_text");
    button.setAlignment(Pos.CENTER_LEFT);

    if (bgColor == 1) {
        button.getStyleClass().add("button-icon_text--transparent");
    } else {
        button.getStyleClass().add("button-icon_text--white");
    }

    layout.setConstraints(button, 0, position);
    layout.setHalignment(button, HPos.CENTER);
    layout.setValignment(button, VPos.CENTER);
    layout.getChildren().add(button);
}
JrdsAdapterDialog.java 文件源码 项目:binjr 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Initializes a new instance of the {@link JrdsAdapterDialog} class.
 *
 * @param owner the owner window for the dialog
 */
public JrdsAdapterDialog(Node owner) {
    super(owner, Mode.URL);
    this.parent.setHeaderText("Connect to a JRDS source");
    this.tabsChoiceBox = new ChoiceBox<>();
    tabsChoiceBox.getItems().addAll(JrdsTreeViewTab.values());
    this.extraArgumentTextField = new TextField();
    HBox.setHgrow(extraArgumentTextField, Priority.ALWAYS);
    HBox hBox = new HBox(tabsChoiceBox, extraArgumentTextField);
    hBox.setSpacing(10);
    GridPane.setConstraints(hBox, 1, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
    tabsChoiceBox.getSelectionModel().select(JrdsTreeViewTab.HOSTS_TAB);
    Label tabsLabel = new Label("Sorted By:");
    GridPane.setConstraints(tabsLabel, 0, 2, 1, 1, HPos.LEFT, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS, new Insets(4, 0, 4, 0));
    this.paramsGridPane.getChildren().addAll(tabsLabel, hBox);
    extraArgumentTextField.visibleProperty().bind(Bindings.createBooleanBinding(() -> this.tabsChoiceBox.valueProperty().get().getArgument() != null, this.tabsChoiceBox.valueProperty()));
}
BottomSlidePane.java 文件源码 项目:markdown-writer-fx 阅读 19 收藏 0 点赞 0 评论 0
@Override
protected void layoutChildren() {
    double width = getWidth();
    double height = getHeight();

    Node center = getCenter();
    Node bottom = getBottom();

    double bottomHeight = 0;
    if (bottom != null) {
        double bottomPrefHeight = bottom.prefHeight(-1);
        bottomHeight = bottomPrefHeight * bottomVisibility.get();

        layoutInArea(bottom, 0, height - bottomHeight, width, bottomPrefHeight, 0, HPos.LEFT, VPos.BOTTOM);
    }

    if (center != null)
        layoutInArea(center, 0, 0, width, height - bottomHeight, 0, HPos.CENTER, VPos.CENTER);
}
JavaFXIcon.java 文件源码 项目:JVx.javafx 阅读 18 收藏 0 点赞 0 评论 0
/**
 * {@inheritDoc}
 */
@Override
public void setHorizontalAlignment(int pHorizontalAlignment)
{
    horizontalAlignment = pHorizontalAlignment;

    if (pHorizontalAlignment == ALIGN_STRETCH)
    {
        resource.setHorizontalAlignment(HPos.CENTER);
        resource.setHorizontalStretched(true);
    }
    else
    {
        resource.setHorizontalAlignment(FXAlignmentUtil.alignmentToHPos(horizontalAlignment, HPos.CENTER));
        resource.setHorizontalStretched(false);
    }
}
DataRowCell.java 文件源码 项目:JVx.javafx 阅读 19 收藏 0 点赞 0 评论 0
/**
 * {@inheritDoc}
 */
@Override
protected void layoutChildren()
{
    super.layoutChildren();

    if (renderer != null)
    {
        layoutChild(renderer, false, HPos.CENTER);
        renderer.setDisable(!isEnabled());
    }

    if (dropdownArrow != null)
    {
        layoutChild(dropdownArrow, false, HPos.RIGHT);
        dropdownArrow.setVisible(isEnabled());
    }

    if (editor != null)
    {
        layoutChild(editor, true, HPos.CENTER);
    }
}
FXMonthViewSkin.java 文件源码 项目:JVx.javafx 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Adds the given {@link Node} to the given {@link GridPane} at the given
 * location with the given parameters.
 * 
 * @param pGridPane the {@link GridPane}.
 * @param pNode the {@link Node} to add.
 * @param pColumn the index of the column.
 * @param pRow the index of the row.
 * @param pHGrow if the {@link Node} should grow horizontally.
 * @param pVGrow if the {@link Node} should grow vertically.
 */
private void addToGridPane(GridPane pGridPane, Node pNode, int pColumn, int pRow, boolean pHGrow, boolean pVGrow)
{
    pGridPane.add(pNode, pColumn, pRow);

    if (pHGrow)
    {
        GridPane.setHgrow(pNode, Priority.ALWAYS);
    }
    if (pVGrow)
    {
        GridPane.setVgrow(pNode, Priority.ALWAYS);
    }

    GridPane.setHalignment(pNode, HPos.CENTER);
    GridPane.setValignment(pNode, VPos.CENTER);
}
FXAlignmentUtil.java 文件源码 项目:JVx.javafx 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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;

    }
}
FXImageViewer.java 文件源码 项目:JVx.javafx 阅读 77 收藏 0 点赞 0 评论 0
/**
 * {@inheritDoc}
 */
@Override
protected void updateComponentState() throws ModelException
{
    component.setHorizontalAlignment(FXAlignmentUtil.alignmentToHPos(imageViewer, HPos.CENTER));
    component.setVerticalAlignment(FXAlignmentUtil.alignmentToVPos(imageViewer, VPos.CENTER));

    byte[] value = getValue();

    if (value != null)
    {
        component.setImage(new Image(new ByteArrayInputStream(value)));
    }
    else
    {
        component.setImage(null);
    }
}
FXImageViewer.java 文件源码 项目:JVx.javafx 阅读 20 收藏 0 点赞 0 评论 0
/**
 * {@inheritDoc}
 */
@Override
public void cancelEditing() throws ModelException
{
    component.setHorizontalAlignment(FXAlignmentUtil.alignmentToHPos(cellEditor, HPos.CENTER));
    component.setVerticalAlignment(FXAlignmentUtil.alignmentToVPos(cellEditor, VPos.CENTER));

    byte[] value = getValue();

    if (value != null)
    {
        component.setImage(new Image(new ByteArrayInputStream(value)));
    }
    else
    {
        component.setImage(null);
    }
}
FXChoiceCellEditor.java 文件源码 项目:JVx.javafx 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Creates a new instance of {@link ChoiceBoxCellEditorHandler}.
 *
 * @param pCellEditor the cell editor.
 * @param pCellEditorListener the cell editor listener.
 * @param pDataRow the data row.
 * @param pColumnName the column name.
 */
public ChoiceBoxCellEditorHandler(FXChoiceCellEditor pCellEditor, ICellEditorListener pCellEditorListener, IDataRow pDataRow, String pColumnName)
{
    super(pCellEditor, pCellEditorListener, new FXImageChoiceBox<>(pCellEditor::getAllowedValues, pCellEditor::getImageNames, pCellEditor::getDefaultImageName),
            pDataRow,
            pColumnName);

    registerKeyEventFilter();

    component.setHorizontalAlignment(FXAlignmentUtil.alignmentToHPos(cellEditor, HPos.CENTER));
    component.setVerticalAlignment(FXAlignmentUtil.alignmentToVPos(cellEditor, VPos.CENTER));

    if (isSavingImmediate())
    {
        attachValueChangeListener(component.valueProperty());
    }
}
FXTextAreaTestMain.java 文件源码 项目:JVx.javafx 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void start(Stage primaryStage)
{
    FXTextArea textArea = new FXTextArea("This is a text area.\nMultiple lines are supported.");

    ComboBox<HPos> alignmentBox = new ComboBox<>();
    alignmentBox.getItems().addAll(HPos.values());
    alignmentBox.setValue(textArea.getAlignment());
    textArea.alignmentProperty().bind(alignmentBox.valueProperty());

    FXFormPane controlPane = new FXFormPane();
    controlPane.setNewlineCount(99);
    controlPane.getChildren().add(new Label("Alignment"));
    controlPane.getChildren().add(alignmentBox);

    BorderPane root = new BorderPane();
    root.setTop(controlPane);
    root.setCenter(textArea);
    BorderPane.setAlignment(root.getCenter(), Pos.CENTER);

    primaryStage.setScene(new Scene(root));
    primaryStage.setTitle("JavaFX PositioningPane Test");
    primaryStage.show();
}


问题


面经


文章

微信
公众号

扫码关注公众号