Java Code Examples for javafx.geometry.Insets#getBottom()
The following examples show how to use
javafx.geometry.Insets#getBottom() .
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: FridayFunSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
private void resize() { Insets padding = getSkinnable().getPadding(); double availableWidth = getSkinnable().getWidth() - padding.getLeft() - padding.getRight(); double availableHeight = getSkinnable().getHeight() - padding.getTop() - padding.getBottom(); double width = Math.max(Math.min(Math.min(availableWidth, availableHeight), MAXIMUM_SIZE), MINIMUM_SIZE); double scalingFactor = width / ARTBOARD_SIZE; if (availableWidth > 0 && availableHeight > 0) { drawingPane.relocate((getSkinnable().getWidth() - ARTBOARD_SIZE) * 0.5, (getSkinnable().getHeight() - ARTBOARD_SIZE) * 0.5); drawingPane.setScaleX(scalingFactor); drawingPane.setScaleY(scalingFactor); } }
Example 2
Source File: PieSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
private void resize() { Insets padding = getSkinnable().getPadding(); double availableWidth = getSkinnable().getWidth() - padding.getLeft() - padding.getRight(); double availableHeight = getSkinnable().getHeight() - padding.getTop() - padding.getBottom(); double width = Math.max(Math.min(Math.min(availableWidth, availableHeight * ASPECT_RATIO), MAXIMUM_WIDTH), MINIMUM_WIDTH); double scalingFactor = width / ARTBOARD_WIDTH; if (availableWidth > 0 && availableHeight > 0) { drawingPane.relocate((getSkinnable().getWidth() - ARTBOARD_WIDTH) * 0.5, (getSkinnable().getHeight() - ARTBOARD_HEIGHT) * 0.5); drawingPane.setScaleX(scalingFactor); drawingPane.setScaleY(scalingFactor); } }
Example 3
Source File: SlimSkin.java From WorkbenchFX with Apache License 2.0 | 6 votes |
private void resize() { Insets padding = getSkinnable().getPadding(); double availableWidth = getSkinnable().getWidth() - padding.getLeft() - padding.getRight(); double availableHeight = getSkinnable().getHeight() - padding.getTop() - padding.getBottom(); double width = Math.max(Math.min(Math.min(availableWidth, availableHeight * ASPECT_RATIO), MAXIMUM_WIDTH), MINIMUM_WIDTH); double scalingFactor = width / ARTBOARD_WIDTH; if (availableWidth > 0 && availableHeight > 0) { drawingPane.relocate((getSkinnable().getWidth() - ARTBOARD_WIDTH) * 0.5, (getSkinnable().getHeight() - ARTBOARD_HEIGHT) * 0.5); drawingPane.setScaleX(scalingFactor); drawingPane.setScaleY(scalingFactor); } }
Example 4
Source File: StaticProgressIndicatorSkin.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void layoutChildren() { Insets controlInsets = control.getInsets(); final double w = control.getWidth() - controlInsets.getLeft() - controlInsets.getRight(); final double h = control.getHeight() - controlInsets.getTop() - controlInsets.getBottom(); final double prefW = pathsG.prefWidth(-1); final double prefH = pathsG.prefHeight(-1); double scaleX = w / prefW; double scale = scaleX; if ((scaleX * prefH) > h) { scale = h / prefH; } double indicatorW = prefW * scale - 3; double indicatorH = prefH * scale - 3; pathsG.resizeRelocate((w - indicatorW) / 2, (h - indicatorH) / 2, indicatorW, indicatorH); }
Example 5
Source File: ConversationBox.java From constellation with Apache License 2.0 | 5 votes |
@Override protected double computePrefHeight(double width) { final Node graphic = getGraphic(); if (graphic == null) { return super.computePrefHeight(width); } else { final Insets padding = getPadding(); width -= padding.getLeft() + padding.getRight(); return graphic.prefHeight(width) + padding.getTop() + padding.getBottom(); } }
Example 6
Source File: LinearSkin.java From WorkbenchFX with Apache License 2.0 | 5 votes |
private void resize() { Insets padding = getSkinnable().getPadding(); double availableWidth = getSkinnable().getWidth() - padding.getLeft() - padding.getRight(); double availableHeight = getSkinnable().getHeight() - padding.getTop() - padding.getBottom(); double actualHeight = Math.max(Math.min(availableHeight, MAXIMUM_HEIGHT), MINIMUM_HEIGHT); double scalingFactorY = actualHeight / ARTBOARD_HEIGHT; double actualWidth = Math.max(Math.min(availableWidth, MAXIMUM_WIDTH), MINIMUM_WIDTH * scalingFactorY); if (availableWidth > 0 && availableHeight > 0) { drawingPane.setMaxSize(actualWidth, actualHeight); drawingPane.setMinSize(actualWidth, actualHeight); drawingPane.relocate((getSkinnable().getWidth() - actualWidth) * 0.5, (getSkinnable().getHeight() - actualHeight) * 0.5); double centerY = actualHeight * 0.5; double thumbHeight = thumbGroup.getLayoutBounds().getHeight(); double scaledStrokeWidth = strokeWidthFromCSS * scalingFactorY; double margin = thumbHeight * 0.5 * scalingFactorY; scale.setStartX(margin); scale.setStartY(centerY); scale.setEndX(actualWidth - margin); scale.setEndY(centerY); scale.setStrokeWidth(scaledStrokeWidth); valueBar.setStartX(margin); valueBar.setStartY(centerY); valueBar.setEndY(centerY); valueBar.setEndX(getThumbGroupXPos(getSkinnable().getPercentage())); valueBar.setStrokeWidth(scaledStrokeWidth); thumbGroup.setLayoutY((actualHeight - thumbHeight) * 0.5); thumbGroup.setLayoutX(getThumbGroupXPos(getSkinnable().getPercentage())); thumbGroup.setScaleX(scalingFactorY); thumbGroup.setScaleY(scalingFactorY); } }
Example 7
Source File: FlowBox.java From FxDock with Apache License 2.0 | 5 votes |
public Helper() { Insets m = getInsets(); top = m.getTop(); bottom = m.getBottom(); left = m.getLeft(); right = m.getRight(); double lh = 0.0; children = getChildren(); sz = children.size(); widths = new double[sz]; for(int i=0; i<sz; i++) { Node ch = children.get(i); if(ch.isManaged()) { double w = ch.prefWidth(-1); widths[i] = w; double h = ch.prefHeight(-1); if(h > lh) { lh = h; } } } lineHeight = lh; }
Example 8
Source File: ParagraphBox.java From RichTextFX with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void layoutChildren() { Insets ins = getInsets(); double w = getWidth() - ins.getLeft() - ins.getRight(); double h = getHeight() - ins.getTop() - ins.getBottom(); double graphicWidth = getGraphicPrefWidth(); double half = text.getLineSpacing() / 2.0; text.resizeRelocate(graphicWidth + ins.getLeft(), ins.getTop() + half, w - graphicWidth, h - half); graphic.ifPresent(g -> g.resizeRelocate(graphicOffset.get() + ins.getLeft(), ins.getTop(), graphicWidth, h)); }
Example 9
Source File: XYChartUtils.java From chart-fx with Apache License 2.0 | 4 votes |
public static double getVerticalInsets(final Insets insets) { return insets.getTop() + insets.getBottom(); }
Example 10
Source File: ConnectorUtils.java From scenic-view with GNU General Public License v3.0 | 4 votes |
public static String serializeInsets(final Insets insets) { return insets.getTop() + "|" + insets.getLeft() + "|" + insets.getRight() + "|" + insets.getBottom(); }
Example 11
Source File: JFXLegendPanel.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public Insets getPadding() { Insets padding = super.getPadding(); return new Insets((padding.getTop() + PADDING_TOP), padding.getRight(), padding.getBottom(), padding.getLeft()); }
Example 12
Source File: JFXChipViewSkin.java From JFoenix with Apache License 2.0 | 4 votes |
public void updateEditorPosition() { final Insets insets = getInsets(); final double width = getWidth(); final double height = getHeight(); final double top = insets.getTop(); final double left = insets.getLeft(); final double bottom = insets.getBottom(); final double right = insets.getRight(); final double insideWidth = width - left - right; final double insideHeight = height - top - bottom; final double newLineEditorX = right + initOffset; final double editorVInsets = editor.snappedTopInset() + editor.snappedBottomInset(); final List<Node> managedChildren = getManagedChildren(); final int mangedChildrenSize = managedChildren.size(); if (mangedChildrenSize > 0) { Region lastChild = (Region) managedChildren.get(mangedChildrenSize - 1); double contentHeight = lastChild.getHeight() + lastChild.getLayoutY(); availableWidth = insideWidth - lastChild.getBoundsInParent().getMaxX(); double minWidth = editor.getMinWidth(); minWidth = minWidth < 0 ? 100 : minWidth; minWidth = Math.max(minWidth, requiredWidth); if (availableWidth > requiredWidth) { moveToNewLine = false; } if (availableWidth < minWidth || moveToNewLine) { layoutInArea(editor, newLineEditorX, contentHeight + root.getVgap(), insideWidth - initOffset, editor.prefHeight(-1), 0, getColumnHAlignmentInternal(), VPos.TOP); editorOnNewLine = true; ensureVisible(editor); } else { layoutInArea(editor, lastChild.getBoundsInParent().getMaxX() + root.getHgap(), lastChild.getLayoutY(), availableWidth - root.getHgap(), lastChild.getHeight() + editorVInsets, 0, getColumnHAlignmentInternal(), getRowVAlignmentInternal()); editorOnNewLine = false; } } else { layoutInArea(editor, newLineEditorX, top, insideWidth - initOffset, editor.prefHeight(-1) , 0, getColumnHAlignmentInternal(), VPos.TOP); editorOnNewLine = true; ensureVisible(editor); } }
Example 13
Source File: JFXNodesList.java From JFoenix with Apache License 2.0 | 4 votes |
@Override protected void layoutChildren() { performingLayout = true; List<Node> children = getChildren(); Insets insets = getInsets(); double width = getWidth(); double rotate = getRotate(); double height = getHeight(); double left = snapSpace(insets.getLeft()); double right = snapSpace(insets.getRight()); double space = snapSpace(getSpacing()); boolean isFillWidth = isFillWidth(); double contentWidth = width - left - right; Pos alignment = getAlignment(); alignment = alignment == null ? Pos.TOP_CENTER : alignment; final HPos hpos = alignment.getHpos(); final VPos vpos = alignment.getVpos(); double y = 0; for (int i = 0, size = children.size(); i < size; i++) { Node child = children.get(i); child.autosize(); child.setRotate(rotate % 180 == 0 ? rotate : -rotate); // init child node if not added using addAnimatedChild method if (!animationsMap.containsKey(child)) { if (child instanceof JFXNodesList) { StackPane container = new StackPane(child); container.setPickOnBounds(false); getChildren().set(i, container); } initChild(child, i, null, true); } double x = 0; double childWidth = child.getLayoutBounds().getWidth(); double childHeight = child.getLayoutBounds().getHeight(); if(childWidth > width){ switch (hpos) { case CENTER: x = snapPosition(contentWidth - childWidth) / 2; break; } Node alignToChild = getAlignNodeToChild(child); if (alignToChild != null && child instanceof Parent) { ((Parent) child).layout(); double alignedWidth = alignToChild.getLayoutBounds().getWidth(); double alignedX = alignToChild.getLayoutX(); if(childWidth / 2 > alignedX + alignedWidth){ alignedWidth = -(childWidth / 2 - (alignedWidth/2 + alignedX)); }else{ alignedWidth = alignedWidth/2 + alignedX - childWidth / 2; } child.setTranslateX(-alignedWidth * Math.cos(Math.toRadians(rotate))); child.setTranslateY(alignedWidth * Math.cos(Math.toRadians(90 - rotate))); } }else{ childWidth = contentWidth; } final Insets margin = getMargin(child); if (margin != null) { childWidth += margin.getLeft() + margin.getRight(); childHeight += margin.getTop() + margin.getRight(); } layoutInArea(child, x, y, childWidth, childHeight, /* baseline shouldn't matter */0, margin, isFillWidth, true, hpos, vpos); y += child.getLayoutBounds().getHeight() + space; if (margin != null) { y += margin.getTop() + margin.getBottom(); } y = snapPosition(y); } performingLayout = false; }
Example 14
Source File: ParagraphBox.java From RichTextFX with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected double computePrefHeight(double width) { Insets insets = getInsets(); double overhead = getGraphicPrefWidth() + insets.getLeft() + insets.getRight(); return text.prefHeight(width - overhead) + insets.getTop() + insets.getBottom() + text.getLineSpacing(); }