javafx.scene.layout.BorderPane.addEventHandler()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(120)

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

BorderPane.addEventHandler介绍

暂无

代码示例

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

@Override
protected void starting() {
  super.starting();
  if (node.getParent() instanceof JFXRippler) {
    JFXRippler rippler = (JFXRippler) node.getParent();
    BorderPane p = new BorderPane(node);
    p.setMaxWidth(((JFXHamburger) node).getWidth());
    p.setMinWidth(((JFXHamburger) node).getWidth());
    p.addEventHandler(MouseEvent.ANY, (event) -> {
      if (!event.isConsumed()) {
        event.consume();
        node.fireEvent(event);
      }
    });
    rippler.setControl(p);
  }
  if (this.getRate() == -1) {
    ((JFXHamburger) node).getChildren().get(1).setVisible(true);
  }
}

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

public class SelectionDemo extends Application {
  @Override
  public void start(Stage primaryStage) {
    Scene scene = new Scene(createPane(), 400, 400);
    primaryStage.setScene(scene);
    primaryStage.show();
  }

  private Parent createPane() {
    BorderPane root = new BorderPane();
    SelectionHandler selectionHandler = new SelectionHandler(root);
    root.addEventHandler(MouseEvent.MOUSE_PRESSED, selectionHandler.getMousePressedEventHandler());

    MyCircle c1 = new MyCircle(40, 40, 20);
    MyCircle c2 = new MyCircle(40, 100, 20);
    MyCircle c3 = new MyCircle(40, 160, 20);
    root.getChildren().addAll(c1, c2, c3);

    return root;
  }

  public static void main(String[] args) {
    launch(args);
  }
}

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

@Override
protected void starting() {
  super.starting();
  if (node.getParent() instanceof JFXRippler) {
    JFXRippler rippler = (JFXRippler) node.getParent();
    BorderPane p = new BorderPane(node);
    p.setMaxWidth(((JFXHamburger) node).getWidth());
    p.setMinWidth(((JFXHamburger) node).getWidth());
    p.addEventHandler(MouseEvent.ANY, (event) -> {
      if (!event.isConsumed()) {
        event.consume();
        node.fireEvent(event);
      }
    });
    rippler.setControl(p);
  }
  if (this.getRate() == -1) {
    ((JFXHamburger) node).getChildren().get(1).setVisible(true);
  }
}

相关文章