本文整理了Java中javafx.scene.Node.prefWidth()
方法的一些代码示例,展示了Node.prefWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.prefWidth()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:prefWidth
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected double computePrefWidth(double height) {
return control.prefWidth(height);
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected double computePrefWidth(double height) {
if (!getChildren().isEmpty()) {
return getChildren().get(0).prefWidth(height);
}
return super.computePrefWidth(height);
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected double computePrefWidth(double height) {
double width = 0.0F;
for (Node child : getChildren()) {
if (child instanceof TabHeaderContainer
&& child.isVisible()
&& (measureClosingTabs || !((TabHeaderContainer) child).isClosing)) {
width += child.prefWidth(height);
}
}
return snapSize(width) + snappedLeftInset() + snappedRightInset();
}
代码示例来源:origin: jfoenixadmin/JFoenix
private void updateScrollOffset(double newOffset) {
double tabPaneWidth = snapSize(isHorizontal() ?
getSkinnable().getWidth() : getSkinnable().getHeight());
double controlTabWidth = 2 * snapSize(rightControlButton.getWidth());
double visibleWidth = tabPaneWidth - controlTabWidth - snappedLeftInset() - SPACER;
// compute all tabs headers width
double offset = 0.0;
for (Node node : headersRegion.getChildren()) {
if (node instanceof TabHeaderContainer) {
double tabHeaderPrefWidth = snapSize(node.prefWidth(-1));
offset += tabHeaderPrefWidth;
}
}
double actualOffset = newOffset;
if ((visibleWidth - newOffset) > offset && newOffset < 0) {
actualOffset = visibleWidth - offset;
} else if (newOffset > 0) {
actualOffset = 0;
}
if (actualOffset != scrollOffset) {
scrollOffset = actualOffset;
headersRegion.requestLayout();
if (!isAnimating()) {
selectedTabLine.setTranslateX(selectedTabLineOffset + scrollOffset * direction);
}
}
}
代码示例来源:origin: org.controlsfx/controlsfx
@Override
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
return content == null ? 0 : content.prefWidth(height);
};
代码示例来源:origin: org.controlsfx/controlsfx
@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
double insets = leftInset + rightInset;
return insets + (content == null ? 0 : content.prefWidth(height));
}
代码示例来源:origin: org.fxmisc.flowless/flowless
@Override
public double prefBreadth(Node node) {
return node.prefWidth(-1);
}
代码示例来源:origin: com.jfoenix/jfoenix
@Override
protected double computePrefWidth(double height) {
return control.prefWidth(height);
}
代码示例来源:origin: org.fxmisc.richtext/richtextfx
double getGraphicPrefWidth() {
if(graphic.isPresent()) {
return graphic.getValue().prefWidth(-1);
} else {
return 0.0;
}
}
代码示例来源:origin: org.jfxtras/jfxtras-common
private double calculateNodeWidth(Node n, MinPrefMax size) {
if (size == MinPrefMax.MIN) {
return n.minWidth(-1);
}
if (size == MinPrefMax.MAX) {
return n.maxWidth(-1);
}
return n.prefWidth(-1);
}
代码示例来源:origin: no.tornado/tornadofx-controls
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
double prefWidth;
if (getSkinnable().getOrientation() == Orientation.VERTICAL)
prefWidth = biggest(n -> n.prefWidth(height)) + leftInset + rightInset;
else
prefWidth = acc(n -> n.prefWidth(height)) + leftInset + rightInset;
return Math.max(prefWidth, getSkinnable().getPrefWidth());
}
代码示例来源:origin: org.controlsfx/controlsfx
@Override protected double computePrefWidth(double height) {
boolean isDefault = true;
double pw = 0;
for (ButtonType buttonType : getDialogPane().getButtonTypes()) {
Button button = (Button) getDialogPane().lookupButton(buttonType);
double buttonPrefWidth = button.getGraphic().prefWidth(-1);
if (isDefault) {
pw = buttonPrefWidth;
isDefault = false;
} else {
pw = Math.min(pw, buttonPrefWidth);
}
}
return pw + gapSize;
}
代码示例来源:origin: com.jfoenix/jfoenix
@Override
protected double computePrefWidth(double height) {
double width = 0.0F;
for (Node child : getChildren()) {
if (child instanceof TabHeaderContainer
&& child.isVisible()
&& (measureClosingTabs || !((TabHeaderContainer) child).isClosing)) {
width += child.prefWidth(height);
}
}
return snapSize(width) + snappedLeftInset() + snappedRightInset();
}
代码示例来源:origin: org.controlsfx/controlsfx
@Override
protected double computePrefWidth(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
if (getSkinnable().getOrientation().equals(Orientation.VERTICAL)) {
OptionalDouble maxWidth = getChildren().stream().mapToDouble(node -> node.prefWidth(-1)).max();
if (maxWidth.isPresent()) {
return maxWidth.getAsDouble();
}
}
return getSkinnable().getPrefWidth();
}
代码示例来源:origin: com.jfoenix/jfoenix
@Override
protected double computePrefWidth(double height) {
if (!getChildren().isEmpty()) {
return getChildren().get(0).prefWidth(height);
}
return super.computePrefWidth(height);
}
代码示例来源:origin: no.tornado/tornadofx-controls
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
double w = text.prefWidth(height);
if (getSkinnable().getGraphic() != null && iconPosition().isVertical())
w += Math.max(getSkinnable().getGraphic().prefWidth(-1), graphicFixedSize());
return w + leftInset + rightInset;
}
代码示例来源:origin: org.eclipse.fx/org.eclipse.fx.ui.panes
private static Size computeSize(@NonNull Node control, boolean flushCache) {
int wHint = FX_DEFAULT, hHint = FX_DEFAULT;
RowData data = getConstraint(control);
if (data != null) {
wHint = data.getWidth();
hHint = data.getHeight();
}
return new Size(control.prefWidth(wHint), control.prefHeight(hHint));
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.panes
private static Size computeSize(@NonNull Node control, boolean flushCache) {
int wHint = FX_DEFAULT, hHint = FX_DEFAULT;
RowData data = getConstraint(control);
if (data != null) {
wHint = data.getWidth();
hHint = data.getHeight();
}
return new Size(control.prefWidth(wHint), control.prefHeight(hHint));
}
代码示例来源:origin: no.tornado/tornadofx-controls
protected void layoutChildren(double x, double y, double w, double h) {
for (Node node : getChildren()) {
if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
double prefHeight = node.prefHeight(-1);
node.resizeRelocate(x, y, w, prefHeight);
y += prefHeight;
} else {
double prefWidth = node.prefWidth(-1);
node.resizeRelocate(x, y, prefWidth, h);
x += prefWidth;
}
}
}
代码示例来源:origin: stackoverflow.com
for (Data<X, Y> horizontalMarker : horizontalMarkers) {
Line line = (Line) horizontalMarker.getNode();
line.setStartX(0);
line.setEndX(getBoundsInLocal().getWidth());
line.setStartY(getYAxis().getDisplayPosition(horizontalMarker.getYValue()) + 0.5); // 0.5 for crispness
line.setEndY(line.getStartY());
line.toFront();
Node text = nodeMap.get(line);
text.relocate(line.getBoundsInParent().getMinX() + line.getBoundsInParent().getWidth()/2 - text.prefWidth(-1) / 2, line.getBoundsInParent().getMinY() - 30);
}
内容来源于网络,如有侵权,请联系作者删除!