javafx.scene.Node.getLayoutX()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(299)

本文整理了Java中javafx.scene.Node.getLayoutX()方法的一些代码示例,展示了Node.getLayoutX()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLayoutX()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getLayoutX

Node.getLayoutX介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateX(-(contentContainer.getLayoutX()
  5. + contentContainer.getLayoutBounds().getMaxX()));
  6. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateX(contentContainer.getLayoutX()
  5. + contentContainer.getLayoutBounds().getMaxX());
  6. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. ((Parent) child).layout();
  2. double alignedWidth = alignToChild.getLayoutBounds().getWidth();
  3. double alignedX = alignToChild.getLayoutX();
  4. if(childWidth / 2 > alignedX + alignedWidth){
  5. alignedWidth = -(childWidth / 2 - (alignedWidth/2 + alignedX));

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) {
  2. super(contentContainer, new Timeline(
  3. new KeyFrame(Duration.ZERO,
  4. new KeyValue(contentContainer.translateXProperty(),
  5. (contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())
  6. * (leftDirection? -1 : 1), Interpolator.LINEAR),
  7. new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
  8. ),
  9. new KeyFrame(Duration.millis(1000),
  10. new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
  11. new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT)
  12. )));
  13. // reduce the number to increase the shifting , increase number to reduce shifting
  14. setCycleDuration(Duration.seconds(0.4));
  15. setDelay(Duration.seconds(0));
  16. }
  17. }

代码示例来源:origin: stackoverflow.com

  1. double minX = Double.MAX_VALUE;
  2. double maxX = Double.MIN_VALUE;
  3. for (int i = 0; i < children.size(); i++) {
  4. Node node = children.get(i);
  5. if (node.isManaged()) {
  6. final double x = node.getLayoutBounds().getMinX() + node.getLayoutX();
  7. minX = Math.min(minX, x);
  8. maxX = Math.max(maxX, x + node.minWidth(-1));
  9. }
  10. }

代码示例来源:origin: org.fxmisc.flowless/flowless

  1. @Override
  2. public double layoutY(Node node) {
  3. return node.getLayoutX();
  4. }

代码示例来源:origin: org.fxmisc.flowless/flowless

  1. @Override
  2. public double layoutX(Node node) {
  3. return node.getLayoutX();
  4. }

代码示例来源:origin: stackoverflow.com

  1. import javafx.scene.Node;
  2. import javafx.scene.paint.Paint;
  3. import javafx.scene.shape.Rectangle;
  4. public class City extends Rectangle {
  5. public City(final Node node) {
  6. super(node.getLayoutX(), node.getLayoutY(), 32, 32);
  7. this.setFill(Paint.valueOf("BLUE"));
  8. }
  9. }

代码示例来源:origin: stackoverflow.com

  1. //gets the display region of the chart
  2. Node chartPlotArea = chart.lookup(".chart-plot-background");
  3. double chartZeroX = chartPlotArea.getLayoutX();
  4. double chartZeroY = chartPlotArea.getLayoutY();

代码示例来源:origin: stackoverflow.com

  1. private void clickOnMe(ObservableList<Node> nodes){
  2. for(Node n : nodes){
  3. n.fireEvent(new MouseEvent(MouseEvent.MOUSE_CLICKED,
  4. n.getLayoutX(), n.getLayoutY(), n.getLayoutX(), n.getLayoutY(), MouseButton.PRIMARY, 1,
  5. true, true, true, true, true, true, true, true, true, true, null));
  6. }
  7. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. @Override
  2. protected double computeValue() {
  3. return senderNode.getLayoutX()
  4. + senderNode.getTranslateX()
  5. + senderShape.getRadius();
  6. }
  7. };

代码示例来源:origin: com.jfoenix/jfoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateX(-(contentContainer.getLayoutX()
  5. + contentContainer.getLayoutBounds().getMaxX()));
  6. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateX(contentContainer.getLayoutX()
  5. + contentContainer.getLayoutBounds().getMaxX());
  6. }

代码示例来源:origin: com.miglayout/miglayout-javafx

  1. private static Rectangle2D getBounds(Node node)
  2. {
  3. Bounds lBounds = node.getLayoutBounds();
  4. return new Rectangle2D(
  5. node.getLayoutX(),
  6. node.getLayoutY(),
  7. lBounds.getWidth(),
  8. lBounds.getHeight()
  9. );
  10. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. @Override
  2. protected void layoutChildren() {
  3. getParent().requestLayout();
  4. super.layoutChildren();
  5. for (Node n : getManagedChildren()) {
  6. if (n instanceof Region) {
  7. Region p = (Region) n;
  8. double width = Math.max(p.getMinWidth(), p.getPrefWidth());
  9. double height = Math.max(p.getMinHeight(), p.getPrefHeight());
  10. n.resize(width, height);
  11. double nX = Math.min(0, n.getLayoutX());
  12. double nY = Math.min(0, n.getLayoutY());
  13. n.relocate(nX, nY);
  14. }
  15. }
  16. }

代码示例来源:origin: nl.cloudfarming.client/calendar-api

  1. protected void mouseClicked(MouseEvent mouseEvent) {
  2. if (axisEventHandler != null) {
  3. Node node = (Node) mouseEvent.getSource();
  4. double position = node.getLayoutX() + node.getLayoutBounds().getWidth() / 2;
  5. DateTime clickedDate = getValueForDisplay(position);
  6. AxisEvent<DateTime> event = new AxisEvent<>(clickedDate);
  7. axisEventHandler.handle(event);
  8. }
  9. }

代码示例来源:origin: org.jfxtras/jfxtras-test-support

  1. public AssertNode assertXYWH(double x, double y, double w, double h, double accuracy) {
  2. Assert.assertEquals(description + ", X", x, node.getLayoutX(), accuracy);
  3. Assert.assertEquals(description + ", Y", y, node.getLayoutY(), accuracy);
  4. Assert.assertEquals(description + ", W", w, width(node), accuracy);
  5. Assert.assertEquals(description + ", H", h, height(node), accuracy);
  6. return this;
  7. }

代码示例来源:origin: stackoverflow.com

  1. EventHandler<MouseEvent> onMouseReleasedEventHandler = new EventHandler<MouseEvent>() {
  2. @Override
  3. public void handle(MouseEvent t) {
  4. fixPosition((Node) t.getSource());
  5. }
  6. };
  7. resource.setOnMouseReleased(onMouseReleasedEventHandler);
  8. private void fixPosition( Node node) {
  9. double x = node.getTranslateX();
  10. double y = node.getTranslateY();
  11. node.relocate(node.getLayoutX() + x, node.getLayoutY() + y);
  12. node.setTranslateX(0);
  13. node.setTranslateY(0);
  14. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. protected void initSenderAndReceiver() {
  2. receiverConnectorUI = new Circle(15);
  3. final VNode sender = getSender().getNode();
  4. final FXFlowNodeSkin senderSkin = (FXFlowNodeSkin) getController().
  5. getNodeSkinLookup().getById(skinFactory, sender.getId());
  6. senderShape = senderSkin.getConnectorShape(getSender());
  7. final Node senderNode = senderShape.getNode();
  8. senderConnectorUI = senderShape;
  9. receiverConnectorUI.setLayoutX(senderNode.getLayoutX()
  10. +receiverConnectorUI.getRadius());
  11. receiverConnectorUI.setLayoutY(senderNode.getLayoutY()
  12. +receiverConnectorUI.getRadius());
  13. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) {
  2. super(contentContainer, new Timeline(
  3. new KeyFrame(Duration.ZERO,
  4. new KeyValue(contentContainer.translateXProperty(),
  5. (contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())
  6. * (leftDirection? -1 : 1), Interpolator.LINEAR),
  7. new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
  8. ),
  9. new KeyFrame(Duration.millis(1000),
  10. new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
  11. new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT)
  12. )));
  13. // reduce the number to increase the shifting , increase number to reduce shifting
  14. setCycleDuration(Duration.seconds(0.4));
  15. setDelay(Duration.seconds(0));
  16. }
  17. }

相关文章

Node类方法