javafx.scene.control.TreeView.setOnMouseClicked()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(148)

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

TreeView.setOnMouseClicked介绍

暂无

代码示例

代码示例来源:origin: it.unibo.alchemist/alchemist-projectview

this.treeView.setOnMouseClicked(mouseEv -> {
  final File target = new File(selectedFile);
  if (mouseEv.getClickCount() == 2 && target.exists() && target.isFile()) {

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

/**
 * Create a new skin
 *
 * @param control
 *            the control
 * @param selectedItems
 *            the selected items
 */
public ResourceTreeViewSkin(ResourceTreeView control,
    ObservableList<ResourceItem> selectedItems) {
  super(control);
  this.selectedItems = selectedItems;
  this.tree = new TreeView<>();
  this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull ResourceItem>(
      ResourceTreeViewSkin::handleDirLabel, this::handleStyleclass));
  this.tree.setShowRoot(false);
  this.tree.getSelectionModel().getSelectedItems()
      .addListener(this::handleSelectionChange);
  this.tree.setOnMouseClicked( e -> {
    if( e.getClickCount() > 1 ) {
      openSelectedResources();
    }
  });
  getChildren().add(this.tree);
  control.rootDirectoriesProperty().addListener(this::rebuildTable);
  control.iconSizeProperty().addListener(this::rebuildTable);
  rebuildTable(control.rootDirectoriesProperty());
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

/**
 * Create a new skin
 *
 * @param control
 *            the control
 * @param selectedItems
 *            the selected items
 */
public DirectoryTreeViewSkin(DirectoryTreeView control,
    ObservableList<DirItem> selectedItems) {
  super(control);
  this.selectedItems = selectedItems;
  this.tree = new TreeView<>();
  this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull DirItem>(
      DirectoryTreeViewSkin::handleDirLabel, this::handleStyleclass));
  this.tree.setShowRoot(false);
  this.tree.getSelectionModel().getSelectedItems()
      .addListener(this::handleSelectionChange);
  this.tree.setOnMouseClicked( e -> {
    if( e.getClickCount() > 1 ) {
      openSelectedResources();
    }
  });
  getChildren().add(this.tree);
  control.rootDirectoriesProperty().addListener(this::rebuildTable);
  control.iconSizeProperty().addListener(this::rebuildTable);
  rebuildTable(control.rootDirectoriesProperty());
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

/**
 * Create a new skin
 *
 * @param control
 *            the control
 * @param selectedItems
 *            the selected items
 */
public DirectoryTreeViewSkin(DirectoryTreeView control,
    ObservableList<DirItem> selectedItems) {
  super(control);
  this.selectedItems = selectedItems;
  this.tree = new TreeView<>();
  this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull DirItem>(
      DirectoryTreeViewSkin::handleDirLabel, this::handleStyleclass));
  this.tree.setShowRoot(false);
  this.tree.getSelectionModel().getSelectedItems()
      .addListener(this::handleSelectionChange);
  this.tree.setOnMouseClicked( e -> {
    if( e.getClickCount() > 1 ) {
      openSelectedResources();
    }
  });
  getChildren().add(this.tree);
  control.rootDirectoriesProperty().addListener(this::rebuildTable);
  control.iconSizeProperty().addListener(this::rebuildTable);
  rebuildTable(control.rootDirectoriesProperty());
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

/**
 * Create a new skin
 *
 * @param control
 *            the control
 * @param selectedItems
 *            the selected items
 */
public ResourceTreeViewSkin(ResourceTreeView control,
    ObservableList<ResourceItem> selectedItems) {
  super(control);
  this.selectedItems = selectedItems;
  this.tree = new TreeView<>();
  this.tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
  this.tree.setCellFactory((v) -> new SimpleTreeCell<@NonNull ResourceItem>(
      ResourceTreeViewSkin::handleDirLabel, this::handleStyleclass));
  this.tree.setShowRoot(false);
  this.tree.getSelectionModel().getSelectedItems()
      .addListener(this::handleSelectionChange);
  this.tree.setOnMouseClicked( e -> {
    if( e.getClickCount() > 1 ) {
      openSelectedResources();
    }
  });
  getChildren().add(this.tree);
  control.rootDirectoriesProperty().addListener(this::rebuildTable);
  control.iconSizeProperty().addListener(this::rebuildTable);
  rebuildTable(control.rootDirectoriesProperty());
}

相关文章