本文整理了Java中javafx.scene.Node.getLayoutBounds()
方法的一些代码示例,展示了Node.getLayoutBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLayoutBounds()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getLayoutBounds
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* compute the ripple radius
* @return the ripple radius size
*/
protected double computeRippleRadius() {
double width2 = control.getLayoutBounds().getWidth() * control.getLayoutBounds().getWidth();
double height2 = control.getLayoutBounds().getHeight() * control.getLayoutBounds().getHeight();
return Math.min(Math.sqrt(width2 + height2), RIPPLE_MAX_RADIUS) * 1.1 + 5;
}
代码示例来源:origin: jfoenixadmin/JFoenix
protected void setOverLayBounds(Rectangle overlay){
overlay.setWidth(control.getLayoutBounds().getWidth());
overlay.setHeight(control.getLayoutBounds().getHeight());
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected Node getMask() {
Region clip = new Region();
JFXNodeUtils.updateBackground(JFXListCell.this.getBackground(), clip);
double width = control.getLayoutBounds().getWidth();
double height = control.getLayoutBounds().getHeight();
clip.resize(width, height);
return clip;
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected Node getMask() {
Region clip = new Region();
JFXNodeUtils.updateBackground(JFXTreeCell.this.getBackground(), clip);
double width = control.getLayoutBounds().getWidth();
double height = control.getLayoutBounds().getHeight();
clip.resize(width, height);
return clip;
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void initAnimation(Node contentContainer, Node overlay) {
overlay.setOpacity(0);
contentContainer.setTranslateY(contentContainer.getLayoutY()
+ contentContainer.getLayoutBounds().getMaxY());
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void initAnimation(Node contentContainer, Node overlay) {
overlay.setOpacity(0);
contentContainer.setTranslateX(-(contentContainer.getLayoutX()
+ contentContainer.getLayoutBounds().getMaxX()));
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void initAnimation(Node contentContainer, Node overlay) {
overlay.setOpacity(0);
contentContainer.setTranslateX(contentContainer.getLayoutX()
+ contentContainer.getLayoutBounds().getMaxX());
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void initAnimation(Node contentContainer, Node overlay) {
overlay.setOpacity(0);
contentContainer.setTranslateY(-(contentContainer.getLayoutY()
+ contentContainer.getLayoutBounds().getMaxY()));
}
代码示例来源:origin: jfoenixadmin/JFoenix
/**
* creates Ripple effect in the center of the control
* @return a runnable to release the ripple when needed
*/
public Runnable createManualRipple() {
if(!isRipplerDisabled()) {
rippler.setGeneratorCenterX(control.getLayoutBounds().getWidth() / 2);
rippler.setGeneratorCenterY(control.getLayoutBounds().getHeight() / 2);
rippler.createRipple();
return () -> {
// create fade out transition for the ripple
releaseRipple();
};
}
return () -> { };
}
代码示例来源:origin: jfoenixadmin/JFoenix
OverLayRipple() {
super();
setOverLayBounds(this);
this.getStyleClass().add("jfx-rippler-overlay");
// update initial position
if(JFXRippler.this.getChildrenUnmodifiable().contains(control)) {
double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX());
double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY());
Bounds bounds = control.getBoundsInParent();
this.setX(bounds.getMinX() + diffMinX - snappedLeftInset());
this.setY(bounds.getMinY() + diffMinY - snappedTopInset());
}
// set initial attributes
setOpacity(0);
setCache(true);
setCacheHint(CacheHint.SPEED);
setCacheShape(true);
setManaged(false);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
@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);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
double borderWidth = ripplerPane.getBorder() != null ? ripplerPane.getBorder().getInsets().getTop() : 0;
Bounds bounds = control.getBoundsInParent();
double width = control.getLayoutBounds().getWidth();
double height = control.getLayoutBounds().getHeight();
double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX());
double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY());
double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX());
double diffMaxY = Math.abs(control.getBoundsInLocal().getMaxY() - control.getLayoutBounds().getMaxY());
Node mask;
switch (getMaskType()) {
代码示例来源:origin: jfoenixadmin/JFoenix
private void updateTextPos() {
double textWidth = textNode.getLayoutBounds().getWidth();
final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth();
switch (getHAlignment()) {
case CENTER:
linesWrapper.promptTextScale.setPivotX(promptWidth / 2);
double midPoint = textRight.get() / 2;
double newX = midPoint - textWidth / 2;
if (newX + textWidth <= textRight.get()) {
textTranslateX.set(newX);
}
break;
case LEFT:
linesWrapper.promptTextScale.setPivotX(0);
break;
case RIGHT:
linesWrapper.promptTextScale.setPivotX(promptWidth);
break;
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
private void updateTextPos() {
double textWidth = textNode.getLayoutBounds().getWidth();
final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth();
switch (getHAlignment()) {
case CENTER:
linesWrapper.promptTextScale.setPivotX(promptWidth / 2);
double midPoint = textRight.get() / 2;
double newX = midPoint - textWidth / 2;
if (newX + textWidth <= textRight.get()) {
textTranslateX.set(newX);
}
break;
case LEFT:
linesWrapper.promptTextScale.setPivotX(0);
break;
case RIGHT:
linesWrapper.promptTextScale.setPivotX(promptWidth);
break;
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
public void show(Node node) {
if (text == null) {
text = (Text) node.lookup(".text");
}
node = text;
if (!isShowing()) {
if (node.getScene() == null || node.getScene().getWindow() == null) {
throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
}
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() +
node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
} else {
// if already showing update location if needed
Window parent = node.getScene().getWindow();
this.show(parent, parent.getX() +
node.localToScene(0, 0).getX() +
node.getScene().getX(),
parent.getY() + node.localToScene(0, 0).getY() +
node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
}
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
return;
double rateX = this.getWidth() / getClip().getLayoutBounds().getWidth();
double rateY = this.getHeight() / getClip().getLayoutBounds().getHeight();
double newRate = Math.max(rateX, rateY) * getScalingFactor();
double animationRate = toggleAnimation == null ? -1 : toggleAnimation.getRate();
if (toggleAnimation.getRate() == 1) {
this.getClip().scaleXProperty().bind(Bindings.createDoubleBinding(() -> {
double X = this.getWidth() / getClip().getLayoutBounds().getWidth();
double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
return Math.max(X, Y) * getScalingFactor();
}, this.widthProperty(), this.heightProperty()));
double X = this.getWidth() / getClip().getLayoutBounds().getWidth();
double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
return Math.max(X, Y) * getScalingFactor();
}, this.widthProperty(), this.heightProperty()));
代码示例来源:origin: jfoenixadmin/JFoenix
public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) {
super(contentContainer, new Timeline(
new KeyFrame(Duration.ZERO,
new KeyValue(contentContainer.translateXProperty(),
(contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())
* (leftDirection? -1 : 1), Interpolator.LINEAR),
new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
),
new KeyFrame(Duration.millis(1000),
new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT)
)));
// reduce the number to increase the shifting , increase number to reduce shifting
setCycleDuration(Duration.seconds(0.4));
setDelay(Duration.seconds(0));
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) {
super(contentContainer, new Timeline(
new KeyFrame(Duration.ZERO,
new KeyValue(contentContainer.translateYProperty(),
(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())
* (topDirection? -1 : 1), Interpolator.LINEAR),
new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
),
new KeyFrame(Duration.millis(1000),
new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT)
)));
// reduce the number to increase the shifting , increase number to reduce shifting
setCycleDuration(Duration.seconds(0.4));
setDelay(Duration.seconds(0));
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
private static Timeline createTimeline(JFXHamburger burger) {
double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
.get(0)
代码示例来源:origin: jfoenixadmin/JFoenix
private static Timeline createTimeline(JFXHamburger burger) {
double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
.get(0)
内容来源于网络,如有侵权,请联系作者删除!