Java Code Examples for javafx.geometry.Insets#getLeft()
The following examples show how to use
javafx.geometry.Insets#getLeft() .
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: JFXTable.java From tuxguitar with GNU Lesser General Public License v2.1 | 6 votes |
public void fillAvailableWidth() { List<TableColumn<UITableItem<T>, ?>> columns = this.getControl().getColumns(); if(!columns.isEmpty()) { Insets padding = getControl().getPadding(); double availableWidth = (this.getControl().getWidth() - (padding.getLeft() + padding.getRight() + VERTICAL_SCROLL_SIZE)); for(TableColumn<UITableItem<T>, ?> column : columns) { availableWidth -= column.getWidth(); } if( availableWidth > 0 ) { TableColumn<UITableItem<T>, ?> lastColumn = columns.get(columns.size() - 1); lastColumn.prefWidthProperty().set(lastColumn.getWidth() + availableWidth); } } }
Example 5
Source File: WhitespaceOverlayFactory.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 6 votes |
@Override void layoutOverlayNodes(int paragraphIndex, List<Node> nodes) { Insets insets = getInsets(); double leftInsets = insets.getLeft(); double topInsets = insets.getTop(); // all paragraphs except last one have line separators boolean showEOL = (paragraphIndex < getTextArea().getParagraphs().size() - 1); Node eolNode = nodes.get(nodes.size() - 1); if (eolNode.isVisible() != showEOL) eolNode.setVisible(showEOL); for (Node node : nodes) { Range range = (Range) node.getUserData(); Rectangle2D bounds = getBounds(range.start, range.end); node.setLayoutX(leftInsets + (node == eolNode ? bounds.getMaxX() : bounds.getMinX())); node.setLayoutY(topInsets + bounds.getMinY()); } }
Example 6
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 7
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 8
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 9
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 10
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 11
Source File: ParagraphBox.java From RichTextFX with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected double computePrefWidth(double ignoredHeight) { Insets insets = getInsets(); return wrapText.get() ? 0 // return 0, VirtualFlow will size it to its width anyway : getGraphicPrefWidth() + text.prefWidth(-1) + insets.getLeft() + insets.getRight(); }
Example 12
Source File: BigDecimalFieldSkin.java From robovm-samples with Apache License 2.0 | 5 votes |
@Override protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) { super.layoutChildren(contentX, contentY, contentWidth, contentHeight); //To change body of generated methods, choose Tools | Templates. Insets insets = getSkinnable().getInsets(); double x = insets.getLeft(); double y = insets.getTop(); double textfieldHeight = contentHeight; double buttonWidth = textField.prefHeight(-1); Insets buttonInsets = btnDown.getInsets(); double textfieldWidth = this.getSkinnable().getWidth()-insets.getLeft()-insets.getRight() - buttonWidth - buttonInsets.getLeft() - buttonInsets.getRight(); layoutInArea(textField, x, y, textfieldWidth, textfieldHeight, Control.USE_PREF_SIZE, HPos.LEFT, VPos.TOP); layoutInArea(btnUp, x+textfieldWidth+buttonInsets.getLeft(), y, buttonWidth, textfieldHeight/2, Control.USE_PREF_SIZE, HPos.LEFT, VPos.TOP); layoutInArea(btnDown, x+textfieldWidth+buttonInsets.getLeft(), y+textfieldHeight/2, buttonWidth, textfieldHeight/2, Control.USE_PREF_SIZE, HPos.LEFT, VPos.TOP); }
Example 13
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 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(); }
Example 15
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 16
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 17
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 18
Source File: XYChartUtils.java From chart-fx with Apache License 2.0 | 4 votes |
public static double getHorizontalInsets(final Insets insets) { return insets.getLeft() + insets.getRight(); }