Java Code Examples for javafx.geometry.HPos#CENTER
The following examples show how to use
javafx.geometry.HPos#CENTER .
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: HistoryListPopup.java From arma-dialog-creator with MIT License | 6 votes |
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(); }
Example 2
Source File: AbstractValueIndicator.java From chart-fx with Apache License 2.0 | 5 votes |
/** * Layouts the label within specified bounds and given horizontal and vertical position, taking into account * {@link #labelHorizontalAnchorProperty() horizontal} and {@link #labelVerticalAnchorProperty() vertical} anchor. * * @param bounds the bounding rectangle with respect to which the label should be positioned * @param hPos relative [0, 1] horizontal position of the label within the bounds * @param vPos relative [0, 1] vertical position of the label within the bounds */ protected final void layoutLabel(final Bounds bounds, final double hPos, final double vPos) { if (label.getText() == null || label.getText().isEmpty()) { getChartChildren().remove(label); return; } double xPos = bounds.getMinX(); double yPos = bounds.getMinY(); xOffset = bounds.getWidth() * hPos; yOffset = bounds.getHeight() * (1 - vPos); final double width = label.prefWidth(-1); final double height = label.prefHeight(width); if (getLabelHorizontalAnchor() == HPos.CENTER) { xOffset -= width / 2; } else if (getLabelHorizontalAnchor() == HPos.RIGHT) { xOffset -= width; } if (getLabelVerticalAnchor() == VPos.CENTER) { yOffset -= height / 2; } else if (getLabelVerticalAnchor() == VPos.BASELINE) { yOffset -= label.getBaselineOffset(); } else if (getLabelVerticalAnchor() == VPos.BOTTOM) { yOffset -= height; } label.resizeRelocate(xPos + xOffset, yPos + yOffset, width, height); addChildNodeIfNotPresent(label); }
Example 3
Source File: Toast.java From DevToolBox with GNU Lesser General Public License v2.1 | 5 votes |
public void show(Node anchor, Side side, double offsetX, double offsetY) { if (anchor == null) { return; } autoCenter = false; HPos hpos = side == Side.LEFT ? HPos.LEFT : side == Side.RIGHT ? HPos.RIGHT : HPos.CENTER; VPos vpos = side == Side.TOP ? VPos.TOP : side == Side.BOTTOM ? VPos.BOTTOM : VPos.CENTER; // translate from anchor/hpos/vpos/offsetX/offsetY into screenX/screenY Point2D point = Utils.pointRelativeTo(anchor, content.prefWidth(-1), content.prefHeight(-1), hpos, vpos, offsetX, offsetY, true); this.show(anchor, point.getX(), point.getY()); }
Example 4
Source File: SpectralMatchPanelFX.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
public SpectralMatchPanelFX(SpectralDBPeakIdentity hit) { super(); this.hit = hit; setMinSize(950, 500); theme = MZmineCore.getConfiguration().getDefaultChartTheme(); SimpleColorPalette palette = MZmineCore.getConfiguration().getDefaultColorPalette(); MAX_COS_COLOR = palette.getPositiveColor(); MIN_COS_COLOR = palette.getNegativeColor(); pnTitle = createTitlePane(); metaDataScroll = createMetaDataPane(); mirrorChart = MirrorChartFactory.createMirrorPlotFromSpectralDBPeakIdentity(hit); MZmineCore.getConfiguration().getDefaultChartTheme().apply(mirrorChart.getChart()); mirrorChartWrapper = new BorderPane(); mirrorChartWrapper.setCenter(mirrorChart); coupleZoomYListener(); // put into main ColumnConstraints ccSpectrum = new ColumnConstraints(400, -1, Region.USE_COMPUTED_SIZE, Priority.ALWAYS, HPos.CENTER, true); ColumnConstraints ccMetadata = new ColumnConstraints(META_WIDTH + 30, META_WIDTH + 30, Region.USE_COMPUTED_SIZE, Priority.NEVER, HPos.LEFT, false); add(pnTitle, 0, 0, 2, 1); add(mirrorChartWrapper, 0, 1); add(metaDataScroll, 1, 1); getColumnConstraints().add(0, ccSpectrum); getColumnConstraints().add(1, ccMetadata); setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); }