javafx.geometry.HPos Java Examples

The following examples show how to use javafx.geometry.HPos. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
                                                             int rowIndex,
                                                             String title1,
                                                             String title2,
                                                             double top) {
    Label label1 = addLabel(gridPane, rowIndex, title1);
    label1.getStyleClass().add("confirmation-label");
    Label label2 = addLabel(gridPane, rowIndex, title2);
    label2.getStyleClass().add("confirmation-value");
    GridPane.setColumnIndex(label2, 1);
    GridPane.setMargin(label1, new Insets(top, 0, 0, 0));
    GridPane.setHalignment(label1, HPos.LEFT);
    GridPane.setMargin(label2, new Insets(top, 0, 0, 0));

    return new Tuple2<>(label1, label2);
}
 
Example #2
Source File: EasyGridPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public void addColumnConstraint(boolean fillWidth, HPos alignment, Priority grow, double maxWidth, double minWidth, double prefWidth, double percentWidth) {
    ColumnConstraints constraint = new ColumnConstraints();
    constraint.setFillWidth(fillWidth);
    constraint.setHalignment(alignment);
    constraint.setHgrow(grow);
    constraint.setMaxWidth(maxWidth);
    constraint.setMinWidth(minWidth);
    constraint.setPrefWidth(prefWidth);

    if (percentWidth >= 0) {
        constraint.setPercentWidth(percentWidth);
    }

    getColumnConstraints().add(constraint);
}
 
Example #3
Source File: BottomSlidePane.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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);
}
 
Example #4
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, Button> addConfirmationLabelButton(GridPane gridPane,
                                                               int rowIndex,
                                                               String labelText,
                                                               String buttonTitle,
                                                               double top) {
    Label label = addLabel(gridPane, rowIndex, labelText);
    label.getStyleClass().add("confirmation-label");

    Button button = new AutoTooltipButton(buttonTitle);
    button.getStyleClass().add("confirmation-value");
    button.setDefaultButton(true);

    GridPane.setColumnIndex(button, 1);
    GridPane.setRowIndex(button, rowIndex);
    GridPane.setMargin(label, new Insets(top, 0, 0, 0));
    GridPane.setHalignment(label, HPos.LEFT);
    GridPane.setMargin(button, new Insets(top, 0, 0, 0));

    gridPane.getChildren().add(button);

    return new Tuple2<>(label, button);
}
 
Example #5
Source File: AlertCell.java    From DashboardFx with GNU General Public License v3.0 6 votes vote down vote up
private void config(){
    this.getStyleClass().add("alert-cell");
    this.setAlignment(Pos.CENTER_LEFT);
    this.setPrefHeight(40D);
    this.title.setStyle("-fx-font-size : 14;");
    this.text.getStyleClass().addAll("h6");
    this.text.setStyle("-fx-fill : -text-color;");
    this.time.setStyle("-fx-text-fill : -text-color; -fx-font-style : italic; ");
    textFlow.getChildren().addAll(text);
    this.content.getChildren().addAll(this.title, textFlow, this.time);
    this.content.setAlignment(Pos.CENTER_LEFT);
    this.getChildren().add(content);
    this.setAlignment(Pos.CENTER);
    HBox.setHgrow(content, Priority.ALWAYS);
    GridPane.setHalignment(this.time, HPos.RIGHT);
    GridPane.setValignment(this.time, VPos.CENTER);
    GridPane.setHgrow(this.time, Priority.ALWAYS);
    HBox.setMargin(this.content, new Insets(0,0,0,10));
}
 
Example #6
Source File: Sample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@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);
        }
    }
}
 
Example #7
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void addOptionsGroup() {
    advancedOptionsGroup = addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("shared.advancedOptions"), Layout.COMPACT_GROUP_DISTANCE);

    advancedOptionsBox = new HBox();
    advancedOptionsBox.setSpacing(40);

    GridPane.setRowIndex(advancedOptionsBox, gridRow);
    GridPane.setColumnIndex(advancedOptionsBox, 0);
    GridPane.setHalignment(advancedOptionsBox, HPos.LEFT);
    GridPane.setMargin(advancedOptionsBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(advancedOptionsBox);

    advancedOptionsBox.getChildren().addAll(getTradeFeeFieldsBox());
}
 
Example #8
Source File: UpdateWindow.java    From Recaf with MIT License 6 votes vote down vote up
/**
 * @param window
 * 		Window reference to handle UI access.
 *
 * @return Update popup.
 */
public static UpdateWindow create(MainWindow window) {
	Label lblTitle = new Label(translate("update.outdated"));
	Label lblVersion = new Label(Recaf.VERSION + " → " + SelfUpdater.getLatestVersion());
	Label lblDate = new Label(SelfUpdater.getLatestVersionDate().toString());
	lblTitle.getStyleClass().add("h1");
	lblDate.getStyleClass().add("faint");
	GridPane grid = new GridPane();
	GridPane.setHalignment(lblVersion, HPos.CENTER);
	GridPane.setHalignment(lblDate, HPos.CENTER);
	grid.setPadding(new Insets(15));
	grid.setHgap(10);
	grid.setVgap(10);
	grid.setAlignment(Pos.CENTER);
	grid.add(new Label(translate("update.available")), 0, 0);
	grid.add(new ActionButton(translate("misc.open"), () -> window.getMenubar().showUpdatePrompt()), 1, 0);
	grid.add(lblVersion, 0, 1, 2, 1);
	grid.add(lblDate, 0, 2, 2, 1);
	return new UpdateWindow(grid, lblTitle);
}
 
Example #9
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple2<Label, TextArea> addConfirmationLabelTextArea(GridPane gridPane,
                                                                   int rowIndex,
                                                                   String title1,
                                                                   String title2,
                                                                   double top) {
    Label label = addLabel(gridPane, rowIndex, title1);
    label.getStyleClass().add("confirmation-label");

    TextArea textArea = addTextArea(gridPane, rowIndex, title2);
    ((JFXTextArea) textArea).setLabelFloat(false);

    GridPane.setColumnIndex(textArea, 1);
    GridPane.setMargin(label, new Insets(top, 0, 0, 0));
    GridPane.setHalignment(label, HPos.LEFT);
    GridPane.setMargin(textArea, new Insets(top, 0, 0, 0));

    return new Tuple2<>(label, textArea);
}
 
Example #10
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createSlideControls() {
    sectionButtonsGroup = new ToggleGroup();

    HBox slideButtons = new HBox();
    slideButtons.setMaxWidth(616);
    slideButtons.getStyleClass().add("dao-launch-tab-box");

    sections.forEach(section -> {
        SectionButton sectionButton = new SectionButton(section.title.toUpperCase(), sections.indexOf(section));
        sectionButton.setMaxWidth(Double.MAX_VALUE);
        HBox.setHgrow(sectionButton, Priority.ALWAYS);
        slideButtons.getChildren().add(sectionButton);
    });

    sectionButtonsGroup.getToggles().get(0).setSelected(true);

    GridPane.setRowIndex(slideButtons, ++rowIndex);
    GridPane.setColumnSpan(slideButtons, 2);
    GridPane.setHalignment(slideButtons, HPos.CENTER);
    GridPane.setHgrow(slideButtons, Priority.NEVER);
    gridPane.getChildren().add(slideButtons);
}
 
Example #11
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Tuple4<Button, BusyAnimation, Label, HBox> addButtonBusyAnimationLabel(GridPane gridPane,
                                                                                     int rowIndex,
                                                                                     int colIndex,
                                                                                     String buttonTitle,
                                                                                     double top) {
    HBox hBox = new HBox();
    hBox.setSpacing(10);

    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);
    button.getStyleClass().add("action-button");

    BusyAnimation busyAnimation = new BusyAnimation(false);

    Label label = new AutoTooltipLabel();
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().addAll(button, busyAnimation, label);

    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setHalignment(hBox, HPos.LEFT);
    GridPane.setColumnIndex(hBox, colIndex);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple4<>(button, busyAnimation, label, hBox);
}
 
Example #12
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Label addMultilineLabel(GridPane gridPane, int rowIndex, String text, double top, double maxWidth) {
    Label label = new AutoTooltipLabel(text);
    label.setWrapText(true);
    label.setMaxWidth(maxWidth);
    GridPane.setHalignment(label, HPos.LEFT);
    GridPane.setHgrow(label, Priority.ALWAYS);
    GridPane.setRowIndex(label, rowIndex);
    GridPane.setMargin(label, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    gridPane.getChildren().add(label);
    return label;
}
 
Example #13
Source File: JFXTreeTableCellSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
protected void layoutChildren(double x, double y, double w, double h) {
    updateDisclosureNode();
    double disclosureWidth = 0;
    Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
    if (disclosureNode.isVisible()) {
        Pos alignment = getSkinnable().getAlignment();
        alignment = alignment == null ? Pos.CENTER_LEFT : alignment;
        layoutInArea(disclosureNode, x + 8, y, w, h, 0, Insets.EMPTY, false, false, HPos.LEFT, VPos.CENTER);
        disclosureWidth = disclosureNode.getLayoutBounds().getWidth() + 18;
    }
    super.layoutChildren(x + disclosureWidth, y, w - disclosureWidth, h);
}
 
Example #14
Source File: Overlay.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
 
Example #15
Source File: AttributeEditorPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void updateItem(Object item, boolean empty) {
    super.updateItem(item, empty);

    AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attrDataType);
    final String displayText;
    final List<Node> displayNodes;
    if (item == null) {
        displayText = NO_VALUE_TEXT;
        displayNodes = Collections.emptyList();
    } else {
        displayText = interaction.getDisplayText(item);
        displayNodes = interaction.getDisplayNodes(item, -1, CELL_HEIGHT - 1);
    }

    GridPane gridPane = new GridPane();
    gridPane.setHgap(CELL_ITEM_SPACING);
    ColumnConstraints displayNodeConstraint = new ColumnConstraints(CELL_HEIGHT - 1);
    displayNodeConstraint.setHalignment(HPos.CENTER);

    for (int i = 0; i < displayNodes.size(); i++) {
        final Node displayNode = displayNodes.get(i);
        gridPane.add(displayNode, i, 0);
        gridPane.getColumnConstraints().add(displayNodeConstraint);
    }

    setGraphic(gridPane);
    setPrefHeight(CELL_HEIGHT);
    setText(displayText);
}
 
Example #16
Source File: JFXCheckBoxOldSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
static double computeXOffset(double width, double contentWidth, HPos hpos) {
    switch (hpos) {
        case LEFT:
            return 0;
        case CENTER:
            return (width - contentWidth) / 2;
        case RIGHT:
            return width - contentWidth;
    }
    return 0;
}
 
Example #17
Source File: Exercise_15_05.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create UI
	GridPane pane = new GridPane();
	pane.setVgap(5);
	pane.setHgap(5);
	pane.add(new Label("Investment Amount:"), 0, 0);
	pane.add(tfInvestmentAmount, 1, 0);
	pane.add(new Label("Number Of Years:"), 0, 1);
	pane.add(tfNumberOfYears, 1, 1);
	pane.add(new Label("Annual Interest Rate:"), 0, 2);
	pane.add(tfAnnualInterestRate, 1, 2);
	pane.add(new Label("Future value:"), 0, 3);
	pane.add(tfFutureValue, 1, 3);
	pane.add(btCalculate, 1, 4);

	// Set UI properties
	pane.setAlignment(Pos.CENTER);
	tfInvestmentAmount.setAlignment(Pos.BOTTOM_RIGHT);
	tfNumberOfYears.setAlignment(Pos.BOTTOM_RIGHT);
	tfAnnualInterestRate.setAlignment(Pos.BOTTOM_RIGHT);
	tfFutureValue.setAlignment(Pos.BOTTOM_RIGHT);
	tfFutureValue.setEditable(false);
	pane.setHalignment(btCalculate, HPos.RIGHT);
	pane.setPadding(new Insets(10, 10, 10, 10));

	// Process events
	btCalculate.setOnAction(e -> futureValue());

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane);
	primaryStage.setTitle("Exercise_15_05"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example #18
Source File: QRCodeWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void show() {
    createGridPane();
    addHeadLine();
    addMessage();

    GridPane.setRowIndex(qrCodeImageView, ++rowIndex);
    GridPane.setColumnSpan(qrCodeImageView, 2);
    GridPane.setHalignment(qrCodeImageView, HPos.CENTER);
    gridPane.getChildren().add(qrCodeImageView);

    String request = bitcoinURI.replace("%20", " ").replace("?", "\n?").replace("&", "\n&");
    Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request));
    infoLabel.setMouseTransparent(true);
    infoLabel.setWrapText(true);
    infoLabel.setId("popup-qr-code-info");
    GridPane.setHalignment(infoLabel, HPos.CENTER);
    GridPane.setHgrow(infoLabel, Priority.ALWAYS);
    GridPane.setMargin(infoLabel, new Insets(3, 0, 0, 0));
    GridPane.setRowIndex(infoLabel, ++rowIndex);
    GridPane.setColumnIndex(infoLabel, 0);
    GridPane.setColumnSpan(infoLabel, 2);
    gridPane.getChildren().add(infoLabel);

    addButtons();
    applyStyles();
    display();
}
 
Example #19
Source File: CandleTooltip.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
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 median = new AutoTooltipLabel(Res.get("market.trades.tooltip.candle.median"));
    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(median, 0, 5);
    setConstraints(medianValue, 1, 5);
    setConstraints(date, 0, 6);
    setConstraints(dateValue, 1, 6);

    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, median, medianValue, date, dateValue);
}
 
Example #20
Source File: SunburstChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
@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("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");
}
 
Example #21
Source File: ColumnPane.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * Setup grid.
 */
public ColumnPane() {
	setCenter(grid);
	setPadding(new Insets(5, 10, 5, 10));
	ColumnConstraints column1 = new ColumnConstraints();
	ColumnConstraints column2 = new ColumnConstraints();
	column1.setPercentWidth(70);
	column2.setPercentWidth(30);
	column2.setFillWidth(true);
	column2.setHgrow(Priority.ALWAYS);
	column2.setHalignment(HPos.RIGHT);
	grid.getColumnConstraints().addAll(column1, column2);
	grid.setVgap(5.0);
}
 
Example #22
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addPayInfoEntry(GridPane infoGridPane, int row, String labelText, String value) {
    Label label = new AutoTooltipLabel(labelText);
    TextField textField = new TextField(value);
    textField.setMinWidth(500);
    textField.setEditable(false);
    textField.setFocusTraversable(false);
    textField.setId("payment-info");
    GridPane.setConstraints(label, 0, row, 1, 1, HPos.RIGHT, VPos.CENTER);
    GridPane.setConstraints(textField, 1, row);
    infoGridPane.getChildren().addAll(label, textField);
}
 
Example #23
Source File: WebBrowserDemo.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void layoutChildren()
{
    double w = getWidth();
    double h = getHeight();
    double tbHeight = toolbar.prefHeight(w);
    addressBar.setPrefWidth( addressBar.prefWidth(tbHeight) +
                            (w - toolbar.prefWidth(h)) );
    layoutInArea(browser, 0,tbHeight, w,h-tbHeight, 0, HPos.CENTER, VPos.CENTER);
    layoutInArea(toolbar, 0,0, w,tbHeight, 0, HPos.CENTER,VPos.CENTER);
}
 
Example #24
Source File: WebBrowserDemo.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void layoutChildren()
{
    double w = getWidth();
    double h = getHeight();
    layoutInArea(browser, 0,0, w,h, 0, HPos.CENTER, VPos.CENTER);
}
 
Example #25
Source File: YValueIndicator.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance indicating given Y value belonging to the specified {@code yAxis}, with the specified
 * {@link #textProperty() label}.
 *
 * @param axis the axis this indicator is associated with
 * @param value a value to be marked
 * @param text the text to be shown by the label. Value of {@link #textProperty()}.
 */
public YValueIndicator(final Axis axis, final double value, final String text) {
    super(axis, value, text);
    triangle.getPoints().setAll(0.0, 0.0, 8.0, 8.0, 8.0, -8.0);
    setLabelHorizontalAnchor(HPos.RIGHT);
    setLabelPosition(0.975);

    pickLine.setOnMouseDragged(this::handleDragMouseEvent);
    triangle.setOnMouseDragged(this::handleDragMouseEvent);
    label.setOnMouseDragged(this::handleDragMouseEvent);
}
 
Example #26
Source File: ThermometerRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private void adjustFill(double width, double height, double d)
{
    // '-4' leaves one pixel between top and border,
    // just like there's one pixel all around to the border
    fill.setHeight(d / 2 + (height - d) * (value - min) / (max - min) - 4);
    layoutInArea(fill, 0.0, -d / 2, width, height, 0, HPos.CENTER, VPos.BOTTOM);
}
 
Example #27
Source File: ThermometerRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void layoutChildren()
{
    final double width = computePrefWidth(0);
    final double height = computePrefHeight(0);
    // Limit width
    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);
    rightcorner.setX(Math.max(w - 3, 0));
    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);
}
 
Example #28
Source File: WebViewBrowser.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #29
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example #30
Source File: WebViewBrowser.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
}