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

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

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

JTree.getCellRenderer介绍

暂无

代码示例

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

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

代码示例来源:origin: org.orbisgis/orbisgis-view

/**
 * Update the native renderer.
 * Warning, Used only by PropertyChangeListener on UI property
 */
public void updateLFRenderer() {
    lookAndFeelRenderer = new JTree().getCellRenderer();
}

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

/**
 * Update the native renderer.
 * Warning, Used only by PropertyChangeListener on UI property
 */
public void updateLFRenderer() {
    lookAndFeelRenderer = new JTree().getCellRenderer();
}

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

public void useAsRenderer() {
  existingRenderer = tree.getCellRenderer();
  tree.setCellRenderer(this);
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-explorer

/*******************************************************************************
 *
 *
 ******************************************************************************/
public TreeCellRenderer getCellRenderer()
 {
  patchRenderer(); // so callers would get the real renderer, eventually patched
  return tree.getCellRenderer();
 }

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

private Component getRenderedComponent(Object object) {
 TreeCellRenderer renderer = jTree.getCellRenderer();
 return renderer.getTreeCellRendererComponent(jTree, object,
                        false, false, false, 0, false);
}

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

@SuppressWarnings({"unchecked"})
@Override
public AbstractNavTreeCellRenderer<DefaultTreeModel, N> getTreeCellRenderer() {
  JTree t = getUI();
  if (t == null) {
    return null;
  }
  TreeCellRenderer r = t.getCellRenderer();
  if (r instanceof AbstractNavTreeCellRenderer) {
    return (AbstractNavTreeCellRenderer<DefaultTreeModel, N>) r;
  }
  return null;
}

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

/**
 * Return the wrapped cell renderer.
 * 
 * @return the cell renderer
 */
public javax.swing.tree.TreeCellRenderer getCellRenderer() {
 final javax.swing.tree.TreeCellRenderer ren = super.getCellRenderer();
 if (ren == null)
  return null;
 if (wrapper == null)
  wrapper = new RendererEditorWrapper();
 wrapper.ren = ren;
 return wrapper;
}

代码示例来源:origin: com.github.insubstantial/flamingo

private JLabel getRenderer(Object node) {
  Component renderer = tree.getCellRenderer()
      .getTreeCellRendererComponent(tree, node, false, false,
          tree.getModel().isLeaf(node), 0, false);
  if (renderer instanceof JLabel)
    return (JLabel) renderer;
  return null;
}

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

protected void adjustLeftColumnWidthIfNecessary(DefaultMutableTreeNode node) {
  ChooseManyOfManyNodeDataTwoColumnTreeCellRenderer renderer = (
    ChooseManyOfManyNodeDataTwoColumnTreeCellRenderer)selectedJTree.getCellRenderer();
  renderer.getTreeCellRendererComponent(
    selectedJTree,
    node,
    false,
    false,
    false,
    -1,
    false);
  renderer.adjustLeftColumnWidthIfNecessary();
}

代码示例来源:origin: com.numdata/numdata-swing

public CheckTreeManager( final JTree tree, final CheckTreeSelectionModel selectionModel )
{
  _tree = tree;
  _selectionModel = selectionModel;
  tree.setCellRenderer( new CheckTreeCellRenderer( tree.getCellRenderer(), selectionModel ) );
  tree.addMouseListener( this );
  selectionModel.addTreeSelectionListener( this );
}

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

JTree t = new JTree();
 t.setEditable(true);
 TreeCellRenderer cellRenderer = t.getCellRenderer();
 DefaultTreeCellEditor cellEditor = new DefaultTreeCellEditor(t, (DefaultTreeCellRenderer) cellRenderer){
   @Override
   public boolean isCellEditable(EventObject arg0) {
     if(arg0 instanceof MouseEvent){
       return ((MouseEvent)arg0).getClickCount() > 2;
     }
     return super.isCellEditable(arg0);
   }
 };
 t.setCellEditor(cellEditor);

代码示例来源:origin: net.sf.tinylaf/tinylaf

public void actionPerformed(ActionEvent e) {
    SwitchTreeIcons renderer =
      (SwitchTreeIcons)tree1.getCellRenderer();
    renderer.setShowIcons(((AbstractButton)e.getSource()).isSelected());
    
    renderer =
      (SwitchTreeIcons)tree2.getCellRenderer();
    renderer.setShowIcons(((AbstractButton)e.getSource()).isSelected());
    
    tree1.revalidate();
    tree2.revalidate();
    repaint();
  }            
});

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

public void valueChanged(TreeSelectionEvent e)
{
 JTree tree = (JTree) e.getSource();
 tree.getSelectionModel().clearSelection();
 if (currentSelection != null)
 {
   currentSelection.setBackground(white);
   ((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(white);
 }
 currentSelection = tree;
 currentSelection.setBackground(selectionColor);
 ((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(selectionColor);
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

public void valueChanged(TreeSelectionEvent e)
{
 JTree tree = (JTree) e.getSource();
 tree.getSelectionModel().clearSelection();
 if (currentSelection != null)
 {
   currentSelection.setBackground(white);
   ((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(white);
 }
}

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

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

private void setCloudStatusItemIcon(JTree cloudStatusSubtree, ImageIcon icon)
{
 DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) cloudStatusSubtree.getCellRenderer();
 renderer.setOpenIcon(icon);
 renderer.setClosedIcon(icon);
 renderer.setLeafIcon(null);
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

private void setCloudStatusItemIcon(JTree cloudStatusSubtree, ImageIcon icon)
{
 DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) cloudStatusSubtree.getCellRenderer();
 renderer.setOpenIcon(icon);
 renderer.setClosedIcon(icon);
 renderer.setLeafIcon(null);
}

代码示例来源:origin: robotframework/SwingLibrary

private Component getNodeComponent(Object node, TreePath treePath) {
  int row = tree.getRowForPath(treePath);
  boolean isLeaf = tree.getModel().isLeaf(node);
  boolean hasFocus = tree.getLeadSelectionRow() == row;
  boolean isSelected = tree.isRowSelected(row);
  boolean isExpanded = tree.isExpanded(row);
  TreeCellRenderer cellRenderer = tree.getCellRenderer();
  return cellRenderer.getTreeCellRendererComponent(tree, node, isSelected, isExpanded, isLeaf, row, hasFocus);
}

代码示例来源:origin: bcdev/beam

@Test
public void testThatCellRendererIsSet() {
  final JTree jTree = new JTree();
  final TreeCellRenderer renderer1 = jTree.getCellRenderer();
  assertNotNull(renderer1);
  assertEquals(true, renderer1 instanceof DefaultTreeCellRenderer);
  CatalogTreeUtils.addCellRenderer(jTree);
  final TreeCellRenderer renderer2 = jTree.getCellRenderer();
  assertNotNull(renderer2);
  assertEquals(true, renderer2 instanceof DefaultTreeCellRenderer);
  assertNotSame(renderer1, renderer2);
}

相关文章

JTree类方法