javax.swing.JTree.setRootVisible()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(141)

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

JTree.setRootVisible介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private FilePanel() {
 //data stuff
 FileTreeNode root = new FileTreeNode();
 treeModel = new FileTreeModel(root);
 tree = new JTree(treeModel);
 tree.setCellRenderer(new FileTreeCellRenderer());
 tree.setRootVisible(false);
 tree.setShowsRootHandles(true);
 tree.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent e) {
   TreePath path = tree.getPathForLocation(e.getX(), e.getY());
   int nActiveTreebanks = getActiveTreebanks().size();
   //Tdiff
   boolean canActivate = (! TregexGUI.getInstance().isTdiffEnabled() || nActiveTreebanks < TregexGUI.MAX_TDIFF_TREEBANKS);
   if(path != null) {
    FileTreeNode node = (FileTreeNode) path.getLastPathComponent();
    if(canActivate || node.isActive())
     node.setActive(!node.isActive());
   }
  }
 });
 //layout/panel stuff
 this.setLayout(new BorderLayout());
 this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(),"Tree files: "));
 JScrollPane scroller = new JScrollPane(tree);
 this.add(scroller, BorderLayout.CENTER);
}

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

widgetTree.setRootVisible(false);
widgetTree.setShowsRootHandles(true);
widgetTree.getSelectionModel().addTreeSelectionListener(e ->

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

tree.setRootVisible(false);
tree.getSelectionModel().setSelectionMode
  (TreeSelectionModel.SINGLE_TREE_SELECTION);

代码示例来源:origin: jshiell/checkstyle-idea

resultsTree.setRootVisible(false);

代码示例来源: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: elki-project/elki

/**
 * Constructor with an empty tree model.
 * 
 * This needs to also add a root node, and therefore sets
 * {@code getTree().setRootVisible(false)}.
 */
public TreePopup() {
 this(new DefaultTreeModel(new DefaultMutableTreeNode()));
 tree.setRootVisible(false);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * Constructor with an empty tree model.
 * 
 * This needs to also add a root node, and therefore sets
 * {@code getTree().setRootVisible(false)}.
 */
public TreePopup() {
 this(new DefaultTreeModel(new DefaultMutableTreeNode()));
 tree.setRootVisible(false);
}

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

private JTree createTree(List<String> nodeNames) {
 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Object());
 TreeModel model = new DefaultTreeModel(root);
 for (int i = 0; i < nodeNames.size(); i++) {
  root.add(new DefaultMutableTreeNode(nodeNames.get(i)));
 }
 JTree tree = new JTree(model);
 tree.setRootVisible(false);
 return tree;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Set whether or not the root node from
* the <code>TreeModel</code> is visible.
*
* @param visible <code>true</code> if it is to be displayed
*/
public void setRootVisible(boolean visible) {
  tree.setRootVisible(visible);
  tree.setShowsRootHandles(!visible);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Set whether or not the root node from
* the <code>TreeModel</code> is visible.
*
* @param visible <code>true</code> if it is to be displayed
*/
public void setRootVisible (boolean visible) {
  tree.setRootVisible (visible);
  tree.setShowsRootHandles(!visible);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Set whether or not the root node from
* the <code>TreeModel</code> is visible.
*
* @param visible <code>true</code> if it is to be displayed
*/
public void setRootVisible (boolean visible) {
  tree.setRootVisible (visible);
  tree.setShowsRootHandles(!visible);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

@Override
protected void initTree(JTree tree) {
  tree.setRootVisible(false);
  expandAll(tree);
}

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

MediatorGui.treeDatabase().setRootVisible(true);

代码示例来源:origin: fr.ifremer/isis-fish

protected void createFisheryRegionTree() {
  $objectMap.put("fisheryRegionTree", fisheryRegionTree = new JTree());
  
  fisheryRegionTree.setName("fisheryRegionTree");
  fisheryRegionTree.setRootVisible(true);
  fisheryRegionTree.setSelectionRow(0);
  fisheryRegionTree.addTreeSelectionListener(JAXXUtil.getEventListener(TreeSelectionListener.class, "valueChanged", this, "doValueChanged__on__fisheryRegionTree"));
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-config

protected void createDetectedCallBack() {
  $objectMap.put("detectedCallBack", detectedCallBack = new JTree());
  
  detectedCallBack.setName("detectedCallBack");
  detectedCallBack.setEditable(false);
  detectedCallBack.setRootVisible(false);
  detectedCallBack.setRowHeight(24);
}

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-config

protected void createDetectedCallBack() {
  $objectMap.put("detectedCallBack", detectedCallBack = new JTree());
  
  detectedCallBack.setName("detectedCallBack");
  detectedCallBack.setEditable(false);
  detectedCallBack.setRootVisible(false);
  detectedCallBack.setRowHeight(24);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-designer

protected void componentOpened() {
  super.componentOpened();
  tree = new JTree();
  tree.setRootVisible(true);
  scrollPane = new JScrollPane(tree);
  refresh();
  setLayout(new BorderLayout());
  add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: fr.ifremer/isis-fish

protected void createFisheryRegionTree() {
  $objectMap.put("fisheryRegionTree", fisheryRegionTree = new JTree());
  
  fisheryRegionTree.setName("fisheryRegionTree");
  fisheryRegionTree.setRootVisible(true);
  fisheryRegionTree.setRowHeight(0);
  fisheryRegionTree.setSelectionRow(0);
  fisheryRegionTree.addTreeSelectionListener(JAXXUtil.getEventListener(TreeSelectionListener.class, "valueChanged", this, "doValueChanged__on__fisheryRegionTree"));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-vmd-game

private void init() {
  this.model = new GlobalRepositoryTreeAdapter(gameDesign);
  this.tree = new JTree(model);
  this.tree.setRootVisible(true);
  this.tree.setShowsRootHandles(true);
  
  this.tree.setCellRenderer(new GameDesignTreeNodeRenderer());
  
  
  this.tree.addMouseListener(new TreeMousListener());
}

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

private static JTree createTree() {
  JTree resultsTree = new JTree();
  resultsTree.setName("TREEVIEW");
  resultsTree.setRootVisible(false);
  resultsTree.setEditable(false);
  resultsTree.setShowsRootHandles(true);
  resultsTree.setCellRenderer(new FailureCellRenderer());
  ToolTipManager tipManager = ToolTipManager.sharedInstance();
  tipManager.registerComponent(resultsTree);
  resultsTree.addKeyListener(new EnterPressListener());
  return resultsTree;
}

相关文章

JTree类方法