Package javax.swing.tree

Examples of javax.swing.tree.TreeCellRenderer


        public void updateUI()
        {
            super.updateUI();
            // Make the tree's cell renderer use the table's cell selection
            // colors.
            TreeCellRenderer tcr = getCellRenderer();
            if (tcr instanceof DefaultTreeCellRenderer) {
                DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
                // For 1.1 uncomment this, 1.2 has a bug that will cause an
                // exception to be thrown if the border selection color is
                // null.
View Full Code Here


  // @@ Protected methods
  //////////////////////////////////////////////////

  protected void setColor(Color foreground, Color background)
  {
    TreeCellRenderer tcr = getCellRenderer();
    if (tcr instanceof DefaultTreeCellRenderer)
    {
      DefaultTreeCellRenderer dtcr = (DefaultTreeCellRenderer) tcr;
      dtcr.setForeground(foreground);
      dtcr.setBackground(background);
View Full Code Here

    }

    JTree tree = treeTable.getTree();
    Rectangle bounds = tree.getRowBounds(row);
    int offset = bounds.x;
    TreeCellRenderer tcr = tree.getCellRenderer();

    if (tcr instanceof DefaultTreeCellRenderer)
    {
      Object node = tree.getPathForRow(row).getLastPathComponent();
      Icon icon;
View Full Code Here

    public Component getRendererComponent() {
        TreeModel treeModel = tree.getModel();
        TreePath treePath = tree.getPathForRow(rowIndex);
    if ( treePath == null ) return null;

    TreeCellRenderer renderer = tree.getCellRenderer();
        boolean isSelected = tree.isPathSelected(treePath);
        boolean isExpanded = tree.isExpanded(treePath);
        boolean hasFocus = tree.hasFocus() && rowIndex == tree.getLeadSelectionRow();
        Object item = treePath.getLastPathComponent();
        boolean isLeaf = treeModel.isLeaf(item);
        Component component = renderer.getTreeCellRendererComponent(tree, item, isSelected, isExpanded, isLeaf, rowIndex, hasFocus);
        component.setFont(tree.getFont());
        return component;
    }
View Full Code Here

TOP

Related Classes of javax.swing.tree.TreeCellRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.