javax.swing.tree.TreePath.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(77)

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

TreePath.<init>介绍

暂无

代码示例

代码示例来源:origin: kiegroup/optaplanner

@Override
  public void actionPerformed(ActionEvent e) {
    if (checkBoxTree.getSelectionPath() != null) {
      DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) checkBoxTree.getSelectionPath().getLastPathComponent();
      DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent();
      if (parentNode != null) {
        DefaultMutableTreeNode immediateSiblingNode = directionUp ? (DefaultMutableTreeNode) parentNode.getChildBefore(selectedNode)
            : (DefaultMutableTreeNode) parentNode.getChildAfter(selectedNode);
        if (immediateSiblingNode != null) {
          parentNode.insert(immediateSiblingNode, parentNode.getIndex(selectedNode));
          ((DefaultTreeModel) checkBoxTree.getModel()).nodeStructureChanged(parentNode);
          checkBoxTree.setSelectionPath(new TreePath(selectedNode.getPath()));
        }
      }
    }
  }
}

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

TreeNode[] path = node.getPath();   
TreePath tp = new TreePath(path);
CheckedNode cn = new CheckedNode(false, node.getChildCount() > 0, false);
nodesCheckingState.put(tp, cn);
  DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
  Object obj = node.getUserObject();          
  TreePath tp = new TreePath(node.getPath());
  CheckedNode cn = nodesCheckingState.get(tp);
  if (cn == null) {

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

(DefaultMutableTreeNode)e.nextElement();
if(node.isLeaf()) continue;
int row = tree.getRowForPath(new TreePath(node.getPath()));
tree.expandRow(row);

代码示例来源:origin: camunda/camunda-bpm-platform

protected TreePath getTreePath(CategoryNode node) {
 return new TreePath(node.getPath());
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected void expandRootNode() {
 if (_rootAlreadyExpanded) {
  return;
 }
 _rootAlreadyExpanded = true;
 TreePath path = new TreePath(_model.getRootCategoryNode().getPath());
 expandPath(path);
}

代码示例来源:origin: INRIA/spoon

@Override
  public void run() {
    TreePath path = new TreePath(node.getPath());
    if (!jTree.isExpanded(path)) {
      jTree.expandPath(path);
      jTree.updateUI();
    }
  }
});

代码示例来源:origin: INRIA/spoon

public void setVisible(DefaultMutableTreeNode node) {
  TreePath path = new TreePath(node.getPath());
  getJTree().scrollPathToVisible(path);
  getJTree().setSelectionPath(path);
}

代码示例来源:origin: knowm/XChart

protected void init() {
 // Create the nodes.
 DefaultMutableTreeNode top = new DefaultMutableTreeNode("XChart Example Charts");
 createNodes(top);
 tree = new JTree(top);
 // Create a tree that allows one selection at a time.
 tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 // Listen for when the selection changes.
 tree.addTreeSelectionListener(this);
 // Create the scroll pane and add the tree to it.
 JScrollPane treeView = new JScrollPane(tree);
 // Create Chart Panel
 tabbedPane = new JTabbedPane();
 for (int i = 0; i < tree.getRowCount(); i++) {
  tree.expandRow(i);
 }
 // select first leaf
 DefaultMutableTreeNode firstLeaf = top.getFirstLeaf();
 tree.setSelectionPath(new TreePath(firstLeaf.getPath()));
 // Add the scroll panes to a split pane.
 splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
 splitPane.setTopComponent(treeView);
 splitPane.setBottomComponent(tabbedPane);
 Dimension minimumSize = new Dimension(130, 160);
 treeView.setMinimumSize(minimumSize);
 splitPane.setPreferredSize(new Dimension(700, 700));
 // Add the split pane to this panel.
 add(splitPane);
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.treeDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.treeDatabase() in "+ this.getClass());
  }
  
  // Tree model, update the tree (refresh, add node, etc)
  DefaultTreeModel treeModel = (DefaultTreeModel) MediatorGui.treeDatabase().getModel();
  // First node in tree
  DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
  // Loop into the list of databases
  for (Database database: this.databases) {
    // Create a node model with the database element
    AbstractNodeModel newTreeNodeModel = new NodeModelDatabase(database);
    // Create the node
    DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(newTreeNodeModel);
    // Save the node
    MediatorGui.frame().getTreeNodeModels().put(database, newNode);
    // Add the node to the tree
    root.add(newNode);
  }
  // Refresh the tree
  treeModel.reload(root);
  // Open the root node
  MediatorGui.treeDatabase().expandPath(new TreePath(root.getPath()));
  MediatorGui.treeDatabase().setRootVisible(false);
}

代码示例来源:origin: ron190/jsql-injection

MediatorGui.treeDatabase().expandPath(new TreePath(tableNode.getPath()));

代码示例来源:origin: ron190/jsql-injection

MediatorGui.treeDatabase().expandPath(new TreePath(databaseNode.getPath()));

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public void run()
  {
   if (expand)
   {
     _dialog.treFiles.expandPath(new TreePath(parentNode.getPath()));
   }
  }
});

代码示例来源:origin: org.sonarsource.sslr/sslr-toolkit

@Override
public void selectAstNode(AstNode astNode) {
 if (astNode != null) {
  try {
   astSelectionEventDisabled = true;
   DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode);
   astTree.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath()));
  } finally {
   astSelectionEventDisabled = false;
  }
 }
}

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-toolkit

@Override
public void selectAstNode(AstNode astNode) {
 if (astNode != null) {
  try {
   astSelectionEventDisabled = true;
   DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode);
   astTree.getSelectionModel().addSelectionPath(new TreePath(treeNode.getPath()));
  } finally {
   astSelectionEventDisabled = false;
  }
 }
}

代码示例来源:origin: org.codehaus.sonar.sslr/sslr-toolkit

@Override
public void scrollAstTo(@Nullable AstNode astNode) {
 if (astNode != null) {
  DefaultMutableTreeNode treeNode = getAstTreeNodeWithGivenUserObject((DefaultMutableTreeNode) astTree.getModel().getRoot(), astNode);
  astTree.scrollPathToVisible(new TreePath(treeNode.getPath()));
 }
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void onWindowClosing()
{
 JTree tre = _dialog.treFiles;
 tre.isCollapsed(new TreePath(_recentFilesNode.getPath()));
 Preferences.userRoot().putBoolean(PREF_KEY_RECENT_FILES_EXPANDED, tre.isExpanded(new TreePath(_recentFilesNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_FAVOURITE_FILES_EXPANDED, tre.isExpanded(new TreePath(_favouriteFilesNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_RECENT_ALIAS_FILES_EXPANDED, tre.isExpanded(new TreePath(_recentFilesForAliasNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_FAVOURITE_ALIAS_FILES_EXPANDED, tre.isExpanded(new TreePath(_favouriteFilesForAliasNode.getPath())));
}

代码示例来源:origin: net.imagej/ij

public TreePanel(DefaultMutableTreeNode root, ControlPanel pcp, boolean isMainPanel, Point location) {
  this.root=root;
  this.pcp=pcp;
  this.isMainPanel = isMainPanel;
  defaultLocation = location;
  rootPath=new TreePath(root.getPath());
  title = (String)root.getUserObject();
  buildTreePanel();
  pcp.registerPanel(this);
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

protected void expandRootNode() {
 if (_rootAlreadyExpanded) {
  return;
 }
 _rootAlreadyExpanded = true;
 TreePath path = new TreePath(_model.getRootCategoryNode().getPath());
 expandPath(path);
}

代码示例来源:origin: ontop/ontop

@Override
  public void elementChanged(QueryControllerQuery query) {
    String queryId = query.getID();
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) queryControllerModel.getNode(queryId);
    
    // Select the modified node in the JTree
    treSavedQuery.setSelectionPath(new TreePath(node.getPath()));
    treSavedQuery.scrollPathToVisible(new TreePath(node.getPath()));
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j

protected void expandRootNode() {
 if (_rootAlreadyExpanded) {
  return;
 }
 _rootAlreadyExpanded = true;
 TreePath path = new TreePath(_model.getRootCategoryNode().getPath());
 expandPath(path);
}

相关文章