当前位置: 首页>>代码示例>>Java>>正文


Java TreeSelectionEvent.getPath方法代码示例

本文整理汇总了Java中javax.swing.event.TreeSelectionEvent.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java TreeSelectionEvent.getPath方法的具体用法?Java TreeSelectionEvent.getPath怎么用?Java TreeSelectionEvent.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.event.TreeSelectionEvent的用法示例。


在下文中一共展示了TreeSelectionEvent.getPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
public void valueChanged(TreeSelectionEvent e) {
  super.valueChanged(e);

  final TreePath p = e.getPath();
  if (p != null) {
    final DefaultMutableTreeNode node =
      (DefaultMutableTreeNode) p.getLastPathComponent();

    Object x[] = node.getUserObjectPath();
    Configurable[] userObjectPath = new Configurable[x.length];

    for (int i = 0; i < x.length; i++) {
      userObjectPath[i] = (Configurable) x[i];
    }

    path = ArrayUtils.copyOfRange(userObjectPath, 1, userObjectPath.length);
  }
  else {
    path = null;
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:22,代码来源:ChooseComponentPathDialog.java

示例2: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
public void valueChanged(TreeSelectionEvent e) {
    if (internal) return;
    
    TreePath selected = e.getPath();
    int row = selected == null ? -1 : tree.getRowForPath(selected);
    try {
        internal = true;
        if (row != -1) selectRow(row, !tree.isChangingModel());
        else clearSelection();
    } finally {
        internal = false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProfilerTreeTable.java

示例3: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
/**
 * Tree selection changed, record info about the currently selected component
 */
public void valueChanged(TreeSelectionEvent e) {
  selected = null;
  TreePath path = e.getPath();
  if (path != null) {
    selected = (Configurable) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
    selectedRow = getRowForPath(path);
    updateEditMenu();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:ConfigureTree.java

示例4: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent event) {
    TreePath path = event.getPath();
    if (path.getPathCount() >= 2) {
        DefaultMutableTreeNode node
            = (DefaultMutableTreeNode)path.getPathComponent(1);
        this.selected = (OptionGroup)node.getUserObject();
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:DifficultyDialog.java

示例5: valueChanged

import javax.swing.event.TreeSelectionEvent; //导入方法依赖的package包/类
@Override
public void valueChanged(TreeSelectionEvent e) {
    if (e.getPath() != null
            && e.getPath().getLastPathComponent() instanceof ComponentNode) {
        area.setText("toString(): "
                + ((ComponentNode) e.getPath().getLastPathComponent()).
                getToString());
    } else {
        area.setText("");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:GUIBrowser.java


注:本文中的javax.swing.event.TreeSelectionEvent.getPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。