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

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

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

Node.parentProperty介绍

暂无

代码示例

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

  1. scrollPane.getContent().getParent().addEventHandler(ScrollEvent.ANY, scrollHandler);
  2. scrollPane.getContent().parentProperty().addListener((o,oldVal, newVal)->{
  3. if (oldVal != null) {
  4. oldVal.removeEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);

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

  1. private void displayLabelForData(XYChart.Data<String, Number> data) {
  2. final Node node = data.getNode();
  3. final Text dataText = new Text(data.getYValue() + "");
  4. node.parentProperty().addListener(new ChangeListener<Parent>() {
  5. @Override public void changed(ObservableValue<? extends Parent> ov, Parent oldParent, Parent parent) {
  6. Group parentGroup = (Group) parent;
  7. parentGroup.getChildren().add(dataText);
  8. }
  9. });
  10. node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
  11. @Override public void changed(ObservableValue<? extends Bounds> ov, Bounds oldBounds, Bounds bounds) {
  12. dataText.setLayoutX(
  13. Math.round(
  14. bounds.getMinX() + bounds.getWidth() / 2 - dataText.prefWidth(-1) / 2
  15. )
  16. );
  17. dataText.setLayoutY(
  18. Math.round(
  19. bounds.getMinY() - dataText.prefHeight(-1) * 0.5
  20. )
  21. );
  22. }
  23. });
  24. }

代码示例来源:origin: org.jrebirth.af/core

  1. @Override
  2. public void changed(final ObservableValue<? extends Node> observable, final Node oldValue, final Node newValue) {
  3. if (newValue != null) {
  4. AbstractBaseModel.this.hasBeenAttached = true;
  5. }
  6. if (newValue == null && AbstractBaseModel.this.hasBeenAttached) {
  7. AbstractBaseModel.this.hasBeenAttached = false;
  8. release();
  9. node().parentProperty().removeListener(this);
  10. }
  11. }

代码示例来源:origin: org.jrebirth.af/core

  1. /**
  2. * Attach a custom listener that will release the mode when the rootNode is removed from its parent.
  3. */
  4. protected void attachParentListener() {
  5. final AutoRelease ar = ClassUtility.getLastClassAnnotation(this.getClass(), AutoRelease.class);
  6. // Only manage automatic release when the annotation exists with true value
  7. if (ar != null && ar.value() && node() != null) { // TODO check rootnode null when using NullView
  8. // Allow to release the model if the root business object doesn't exist anymore
  9. node().parentProperty().addListener(new ChangeListener<Node>() {
  10. @Override
  11. public void changed(final ObservableValue<? extends Node> observable, final Node oldValue, final Node newValue) {
  12. if (newValue != null) {
  13. AbstractBaseModel.this.hasBeenAttached = true;
  14. }
  15. if (newValue == null && AbstractBaseModel.this.hasBeenAttached) {
  16. AbstractBaseModel.this.hasBeenAttached = false;
  17. release();
  18. node().parentProperty().removeListener(this);
  19. }
  20. }
  21. });
  22. }
  23. }

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

  1. scrollPane.getContent().getParent().addEventHandler(ScrollEvent.ANY, scrollHandler);
  2. scrollPane.getContent().parentProperty().addListener((o,oldVal, newVal)->{
  3. if (oldVal != null) {
  4. oldVal.removeEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);

相关文章

Node类方法