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

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

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

JTree.setShowsRootHandles介绍

暂无

代码示例

代码示例来源: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.setShowsRootHandles(true);
widgetTree.getSelectionModel().addTreeSelectionListener(e ->

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

protected void init() {
 // Put visible lines on the JTree.
 putClientProperty("JTree.lineStyle", "Angled");
 // Configure the Tree with the appropriate Renderers and Editors.
 CategoryNodeRenderer renderer = new CategoryNodeRenderer();
 setEditable(true);
 setCellRenderer(renderer);
 CategoryNodeEditor editor = new CategoryNodeEditor(_model);
 setCellEditor(new CategoryImmediateEditor(this,
   new CategoryNodeRenderer(),
   editor));
 setShowsRootHandles(true);
 setToolTipText("");
 ensureRootExpansion();
}

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

m_tree.setShowsRootHandles(true); 
m_tree.setEditable(false);

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

this.tree.setShowsRootHandles(true);
this.tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

代码示例来源: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: guru.nidi/jdepend

/**
 * Creates and returns a peered tree.
 *
 * @return Tree.
 */
private JTree createTree() {
  JTree tree = new JTree();
  tree.setShowsRootHandles(false);
  tree.setFont(new Font("Dialog", Font.PLAIN, 12));
  tree.addTreeSelectionListener(this);
  tree.setRootVisible(false);
  tree.setLargeModel(true);
  return tree;
}

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

protected void initTree(JTree tree) {
  tree.setCellRenderer(new CheckBoxTreeCellRenderer());
  tree.setShowsRootHandles(false);
  tree.setRootVisible(false);
  tree.addMouseListener(new CheckBoxTreeNodeSelectionListener());
}

代码示例来源:origin: nroduit/Weasis

public void refresh() {
  final TreePath path = tree.getSelectionPath();
  final TreeNode node = (TreeNode) path.getLastPathComponent();
  node.refresh();
  getTreeModel().reload(node);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  setBackground(Color.white);
  setAlignmentX((float) 0.5);
  tree.setShowsRootHandles(false);
}

代码示例来源: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;
}

代码示例来源:origin: org.scijava/scijava-ui-swing

private void initTreeView() {
  treeModel = new DefaultTreeModel(rootNode);
  tree = new JTree(treeModel);
  tree.setRootVisible(false);
  DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
  cellRenderer.setIcon(null);
  cellRenderer.setLeafIcon(null);
  cellRenderer.setOpenIcon(null);
  tree.setCellRenderer(cellRenderer);
  tree.setComponentPopupMenu(menu);
  tree.setEditable(false);
  tree.setShowsRootHandles(true);
  tree.addTreeSelectionListener(this::selectionChanged);
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

private JScrollPane makeResultPane()
{
 _varTree = new JTree( makeEmptyModel() );
 _varTree.setBorder( null );
 _varTree.setBackground( Scheme.active().getWindow() );
 _varTree.setRootVisible( true );
 _varTree.setShowsRootHandles( true );
 _varTree.setRowHeight( 22 );
 _varTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
 _varTree.setVisibleRowCount( 20 );
 _varTree.setCellRenderer( new VarTreeCellRenderer( _varTree ) );
 return new JScrollPane( _varTree );
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-platform-ui

public PlatformsView () {
  super ();
  this.setPopupAllowed (false);
  this.setDefaultActionAllowed(false);
  this.setRootVisible (false);
  this.tree.setEditable(false);
  this.tree.setShowsRootHandles(false);
  this.setBorder(UIManager.getBorder("Nb.ScrollPane.border")); // NOI18N
  setPreferredSize(new java.awt.Dimension(200, 334));
}

代码示例来源:origin: dcaoyuan/nbscala

public PlatformsView () {
  super ();
  this.setPopupAllowed (false);
  this.setDefaultActionAllowed(false);
  this.setRootVisible (false);
  this.tree.setEditable(false);
  this.tree.setShowsRootHandles(false);
  this.setBorder(UIManager.getBorder("Nb.ScrollPane.border")); // NOI18N
}

代码示例来源:origin: Jamling/SmartIM

protected void initTree(JTree tree) {
  // tree.setCellRenderer(new ContactTreeCellRenderer());
  tree.setShowsRootHandles(false);
  tree.setRootVisible(false);
  tree.addMouseListener(new IMContactDoubleClicker(getImPanel()));
  
}

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

private void configurarArvore()
{
  arvore.setModel(criarModeloInicialArvore());
  arvore.setCellRenderer(new Renderizador());
  arvore.setRootVisible(false);
  arvore.setShowsRootHandles(true);
  arvore.addKeyListener(new ArvoreTopicosKeyListener(arvore));
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-project-libraries-ui

@Messages("AD_Libraries=N/A")
LibrariesView() {
  this.setRootVisible(false);
  this.setPopupAllowed(false);
  this.setDefaultActionAllowed(false);
  this.tree.setEditable (false);
  this.tree.setShowsRootHandles (false);
  this.getAccessibleContext().setAccessibleDescription(AD_Libraries());
}

相关文章

JTree类方法