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

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

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

JTree.setCellRenderer介绍

暂无

代码示例

代码示例来源:origin: skylot/jadx

tree.setCellRenderer(new DefaultTreeCellRenderer() {
  @Override
  public Component getTreeCellRendererComponent(JTree tree,

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

public CheckTreeTableManager(JXTreeTable treeTable) {
  this.treetable = treeTable;
  this.tree = (JTree) treeTable.getCellRenderer(0, 0);
  selectionModel = new CheckTreeSelectionModel(tree.getModel());
  tree.setCellRenderer(new DefaultTreeRenderer(new CheckTreeCellProvider(selectionModel)));
  treeTable.addMouseListener(this);
  selectionModel.addTreeSelectionListener(this);
}

代码示例来源:origin: deathmarine/Luyten

tree.setModel(new DefaultTreeModel(null));
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setCellRenderer(new CellRenderer());
TreeListener tl = new TreeListener();
tree.addMouseListener(tl);

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

this.setCellRenderer(cellRenderer);

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

resultsTree.addMouseListener(treeMouseListener);
resultsTree.addKeyListener(new ToolWindowKeyboardListener());
resultsTree.setCellRenderer(new ResultTreeRenderer());

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

m_tree.setCellRenderer(renderer);

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

model = new SchemaTreeModel(schema);
tree.setModel(model);
tree.setCellRenderer(renderer);
tree.addTreeSelectionListener(this);

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

this.tree.setCellRenderer(new CellRendererNode());

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

tree.setCellRenderer(new CheckTreeCellRenderer(tree.getCellRenderer(), selectionModel));

代码示例来源:origin: javax.help/javahelp

/**
 * Sets the desired cell renderer on this tree.  This is exposed for redefinition
 * by subclases.
 */
protected void setCellRenderer(NavigatorView view, JTree tree) {
  tree.setCellRenderer(new BasicFavoritesCellRenderer());
}

代码示例来源:origin: ome/formats-bsd

/** Constructs a Swing JTree that displays the given XML DOM document. */
public static JTree makeJTree(Document doc) {
 Element rootNode = doc.getDocumentElement();
 DefaultMutableTreeNode rootTreeNode = makeTreeNode(rootNode);
 JTree tree = new JTree(rootTreeNode);
 tree.setCellRenderer(new XMLCellRenderer());
 tree.setRowHeight(0);
 return tree;
}

代码示例来源:origin: otros-systems/otroslogviewer

private void initTree() {
 rootNode = new DefaultMutableTreeNode(new Clazz("root"));
 tree = new JTree(rootNode);
 tree.setCellRenderer(new TreeRenderer());
 clazzNodeMap = new HashMap<>();
 clazzNodeMap.put(new Clazz("root"), rootNode);
 initPopup();
}

代码示例来源:origin: javax.help/javahelp

/**
 * Sets the desired cell renderer on this tree.  This is exposed for redefinition
 * by subclases.
 */
protected void setCellRenderer(NavigatorView view, JTree tree) {
// Use the combined map to drive the TOC tree actions
Map map = view.getHelpSet().getCombinedMap();
tree.setCellRenderer(new BasicTOCCellRenderer(map, (TOCView)view));
}

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

private JTree getJTree() {

  JTree jTree = new JTree();
  jTree.setOpaque(true);
  jTree.setBackground(Color.white);
  UIDefaults paneDefaults = new UIDefaults();
  paneDefaults.put("Tree.selectionBackground",null);

  JTextPane pane = new JTextPane();
  jTree.putClientProperty("Nimbus.Overrides",paneDefaults);
  jTree.putClientProperty("Nimbus.Overrides.InheritDefaults",false);

  jTree.setCellRenderer( new LocalRenderer() );
  return jTree;
}

代码示例来源:origin: igvteam/igv

private void initTree(DefaultMutableTreeNode rootNode) {
  tree = new JTree(rootNode);
  tree.setExpandsSelectedPaths(true);
  tree.setCellRenderer(new NodeRenderer());
  tree.setCellEditor(new ResourceEditor(tree));
  tree.setEditable(true);
}

代码示例来源:origin: antlr/antlr3

public void OnShowSuiteResult(TestSuite suite) {
  update();
  view.tree.setModel(new RunnerTreeModel(suite));
  view.tree.setCellRenderer(new RunnerTreeRenderer());
}

代码示例来源: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.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

/** Creates a new instance of ResultTree */
ResultTreeView() {
  super();
  defaultTreeCellRenderer = tree.getCellRenderer();
  noIconTreeCellRenderer = createNoIconTreeCellRenderer();
  tree.setCellRenderer(new DelegatingTreeCellRenderer());
  tree.setDragEnabled(false);
  
  initAccessibility();
}

相关文章

JTree类方法