Java 类javafx.geometry.HPos 实例源码

项目:marathonv5    文件:Sample.java   
@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);
        }
    }
}
项目:marathonv5    文件:Sample.java   
@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);
        }
    }
}
项目:MineIDE    文件:WizardStepBuilder.java   
/**
 * 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;
}
项目:MineIDE    文件:WizardStepBuilder.java   
/**
 * 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;
}
项目:MineIDE    文件:WizardStepBuilder.java   
/**
 * 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;
}
项目:wall-t    文件:ConfigurationView.java   
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;
}
项目:wall-t    文件:ConfigurationView.java   
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;
}
项目:campingsimulator2017    文件:PermissionsDialog.java   
/**
 * 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);
}
项目:x-facteur    文件:ProxyModal.java   
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;
}
项目:x-facteur    文件:MailmanEditModal.java   
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;
}
项目:x-facteur    文件:ShipmentEditModal.java   
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;
}
项目:CalendarFX    文件:AgendaView.java   
/**
 * 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;
}
项目:WeatherWatch    文件:NotificationPane.java   
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);
}
项目:Gargoyle    文件:DateChooserSkin.java   
@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);
        }

    }
}
项目:Gargoyle    文件:ImageViewPane.java   
@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();
}
项目:arma-dialog-creator    文件:HistoryListPopup.java   
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();
}
项目:openjfx-8u-dev-tests    文件:LayoutTableViewApp.java   
@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;
}
项目:openjfx-8u-dev-tests    文件:SeparatorApp.java   
@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;
}
项目:openjfx-8u-dev-tests    文件:Layout2App.java   
@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;
}
项目:sudoku-desktop-game    文件:global.java   
/**
 * 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);
}
项目:binjr    文件:JrdsAdapterDialog.java   
/**
 * 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()));
}
项目:markdown-writer-fx    文件:BottomSlidePane.java   
@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);
}
项目:JVx.javafx    文件:JavaFXIcon.java   
/**
 * {@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);
    }
}
项目:JVx.javafx    文件:DataRowCell.java   
/**
 * {@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);
    }
}
项目:JVx.javafx    文件:FXMonthViewSkin.java   
/**
 * 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);
}
项目:JVx.javafx    文件:FXAlignmentUtil.java   
/**
 * 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;

    }
}
项目:JVx.javafx    文件:FXImageViewer.java   
/**
 * {@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);
    }
}
项目:JVx.javafx    文件:FXImageViewer.java   
/**
 * {@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);
    }
}
项目:JVx.javafx    文件:FXChoiceCellEditor.java   
/**
 * 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());
    }
}
项目:JVx.javafx    文件:FXTextAreaTestMain.java   
@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();
}
项目:org.csstudio.display.builder    文件:ThermoDemo.java   
@Override
protected void layoutChildren()
{
    final double width = computePrefWidth(0);
    final double height = computePrefHeight(0);
    final double w = clamp(width / 2, 0, 20);
    final double d = clamp(width, w, Math.min(height, 2 * w));
    final double h = height - d;

    fill.setWidth(Math.max(w - 4, 0));
    ellipse.setRadiusX(Math.max(d / 2 - 2, 0));
    ellipse.setRadiusY(Math.max(d / 2 - 2, 0));

    move.setX(w);
    move.setY(h);
    left.setY(h);
    arc.setRadiusX(d / 2);
    arc.setRadiusY(d / 2);
    arc.setX(w);
    arc.setY(h);

    adjustFill(width, height, d);

    layoutInArea(ellipse, 0, -3, width, height, 0, HPos.CENTER, VPos.BOTTOM);
    layoutInArea(border, 0, 0, width, height, 0, HPos.CENTER, VPos.BOTTOM);
}
项目:contentment    文件:ExceptionsScript.java   
public Step whatToTest()
{
    buildPhrase();
    wipe().slide().enter().head("What Could Go Wrong?");
    cue(193);
    letters("Thrower").withOval().at(new Centered(1200d,300d)).format(commentFormat).sketch().called("thrower");
    Column column = new Column(world,new PointPair(1000,400,ViewPort.WIDTH,ViewPort.HEIGHT),HPos.LEFT,VPos.TOP);
    cue(196);
    column.enter();
    column.head(new LettersAtom(column.groupSource(),"1. Notice the fail condition",commentFormat,Position.DEFAULT));
    cue(199);
    column.line(new LettersAtom(column.groupSource(),"2. Construct the exception",commentFormat,Position.DEFAULT));
    cue(202);
    column.line(new LettersAtom(column.groupSource(),"3. throw the exception",commentFormat,Position.DEFAULT));
    return endBuild();
}
项目:jfx-torrent    文件:FilterTorrentsComboBoxSkin.java   
@Override
protected void layoutChildren(final double x, final double y, final double width, final double height) {
    super.layoutChildren(x, y, width, height);

    final double arrowWidth = snapSize(arrow.prefWidth(-1));
    final double arrowButtonWidth = arrowButton.snappedLeftInset() + arrowWidth +
                    arrowButton.snappedRightInset();

    final double filterGraphicWidth = filterGraphic.snappedLeftInset() + snapSize(filterGraphic.prefWidth(-1))
            + filterGraphic.snappedRightInset();

    getChildren().stream()
            .filter(node -> !node.getStyleClass().contains("arrow") && !node.getStyleClass().contains("arrow-button"))
            .forEach(node -> node.resizeRelocate(x + arrowButtonWidth + filterGraphicWidth, y,
                    width - arrowButtonWidth - filterGraphicWidth, height));

    positionInArea(filterGraphic, x, y,
            filterGraphicWidth, height, 0, HPos.LEFT, VPos.CENTER);

    positionInArea(arrowButton, x + filterGraphicWidth, y,
            arrowButtonWidth, height, 0, HPos.CENTER, VPos.CENTER);


}
项目:CS317-project    文件:Calculator.java   
public static void setDisplay(GridPane pane, String n)
{
    //TextField display = new TextField();
    display.setPrefWidth(175);
    display.setPrefHeight(80);
    display.setPromptText(n);


    display.setFont(Font.font("Verdana", FontWeight.BOLD, 25));
    display.setStyle("-fx-text-inner-color: black;");


    pane.setColumnSpan(display, 5);
    pane.setRowSpan(display, 2);
    pane.add(display, 0, 0);
    pane.setHalignment(display, HPos.CENTER);
}
项目:JavaFxNodeToSvg    文件:LabelToSvgConverter.java   
private static SvgTextAnchor determineTextAnchor(Label label) {
    Pos alignment = label.getAlignment();
    HPos horizontalAlignment = alignment.getHpos();

    SvgTextAnchor textAnchor;
    switch (horizontalAlignment) {
    case LEFT:
        textAnchor = SvgTextAnchor.LEFT;
        break;
    case CENTER:
        textAnchor = SvgTextAnchor.MIDDLE;
        break;
    case RIGHT:
        textAnchor = SvgTextAnchor.END;
        break;
    default:
        String message = "The text alignment '" + horizontalAlignment + "' is not known.";
        throw new IllegalStateException(message);
    }
    return textAnchor;
}
项目:incubator-netbeans    文件:WebViewBrowser.java   
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
项目:incubator-netbeans    文件:WebViewBrowser.java   
@Override protected void layoutChildren() {
    List<Node> managed = getManagedChildren();
    double width = getWidth();
    double height = getHeight();
    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);
    }
}
项目:SunburstChart    文件:Demo.java   
@Override public void start(Stage stage) {
    GridPane pane = new GridPane();
    Label nonInteractive = new Label("Non Interactive");
    Label interactive    = new Label("Interactive");

    pane.add(nonInteractive, 0, 0);
    pane.add(nonInteractiveSunburstChart, 0, 1);
    pane.add(interactive, 1, 0);
    pane.add(interactiveSunburstChart, 1, 1);

    GridPane.setHalignment(nonInteractive, HPos.CENTER);
    GridPane.setHalignment(interactive, HPos.CENTER);

    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("JavaFX Sunburst Chart");
    stage.setScene(scene);
    stage.show();

    interactiveSunburstChart.setAutoTextColor(true);

    //timer.start();

    // Calculate number of nodes
    calcNoOfNodes(nonInteractiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in non interactive Sunburst Chart");

    noOfNodes = 0;
    calcNoOfNodes(interactiveSunburstChart);
    System.out.println(noOfNodes + " Nodes in interactive Sunburst Chart");
}
项目:marathonv5    文件:ProxyDialog.java   
public LocalDirPanel() {
    setPadding(new Insets(8));
    setHgap(5.0F);
    setVgap(5.0F);

    int rowIndex = 0;
    Label parentDirLabel = new Label("Local javadoc index.html file");
    parentDirLabel.setId("parent-dir-label");
    GridPane.setConstraints(parentDirLabel, 0, rowIndex);
    getChildren().add(parentDirLabel);

    rowIndex++;
    textField = new TextField();
    textField.setEditable(false);
    GridPane.setConstraints(textField, 0, rowIndex,1,1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.NEVER);

    Button button = new Button("Browse...");
    button.setId("browseButton");
    button.setMinWidth(USE_PREF_SIZE);
    GridPane.setConstraints(button, 1, rowIndex);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setTitle("JavaFX 2.0 Javadoc location");
            FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("html", "*.html");
            fileChooser.getExtensionFilters().add(filter);
            File selectedFile = fileChooser.showOpenDialog(owner);

            okBtn.setDisable(selectedFile == null);
            if (selectedFile != null) {
                textField.setText(selectedFile.getAbsolutePath());
                docsUrl = selectedFile.toURI().toString();
                docsUrl = docsUrl.substring(0,docsUrl.lastIndexOf('/') + 1);
            }
        }
    });
    getChildren().addAll(textField, button);
}
项目:marathonv5    文件:ProxyDialog.java   
public LocalDirPanel() {
    setPadding(new Insets(8));
    setHgap(5.0F);
    setVgap(5.0F);

    int rowIndex = 0;
    Label parentDirLabel = new Label("Local javadoc index.html file");
    parentDirLabel.setId("parent-dir-label");
    GridPane.setConstraints(parentDirLabel, 0, rowIndex);
    getChildren().add(parentDirLabel);

    rowIndex++;
    textField = new TextField();
    textField.setEditable(false);
    GridPane.setConstraints(textField, 0, rowIndex,1,1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.NEVER);

    Button button = new Button("Browse...");
    button.setId("browseButton");
    button.setMinWidth(USE_PREF_SIZE);
    GridPane.setConstraints(button, 1, rowIndex);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setTitle("JavaFX 2.0 Javadoc location");
            FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("html", "*.html");
            fileChooser.getExtensionFilters().add(filter);
            File selectedFile = fileChooser.showOpenDialog(owner);

            okBtn.setDisable(selectedFile == null);
            if (selectedFile != null) {
                textField.setText(selectedFile.getAbsolutePath());
                docsUrl = selectedFile.toURI().toString();
                docsUrl = docsUrl.substring(0,docsUrl.lastIndexOf('/') + 1);
            }
        }
    });
    getChildren().addAll(textField, button);
}