Package javax.swing.tree

Examples of javax.swing.tree.DefaultTreeCellRenderer


        tree = new JTree();
        tree.setRootVisible(false);
        tree.setShowsRootHandles(true);

        DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer();
        treeRenderer.setClosedIcon(null);
        treeRenderer.setLeafIcon(null);
        treeRenderer.setOpenIcon(null);

        tree.setCellRenderer(treeRenderer);

        tree.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
View Full Code Here


            }
            root.add(skins);
        }
        tree = new JTree(root);
        tree.setRootVisible(false);
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(null);
        renderer.setClosedIcon(null);
        renderer.setOpenIcon(null);
        tree.setCellRenderer(renderer);
        tree.addTreeSelectionListener(this);
        int i = 0;
        while (i < tree.getRowCount())
        {
View Full Code Here

     *
     * @return a renderer to draw the test tree nodes
     */
    private TreeCellRenderer getCellRenderer()
    {
        DefaultTreeCellRenderer rend = new JMeterCellRenderer();
        rend.setFont(new Font("Dialog", Font.PLAIN, 11));
        return rend;
    }
View Full Code Here

    this.addMouseListener(new GlobalMouseListener());
  }

  private TreeCellRenderer getCellRenderer()
  {
    DefaultTreeCellRenderer rend = new JMeterCellRenderer();
    rend.setFont(new Font("Dialog", Font.PLAIN, 11));
    return rend;
  }
View Full Code Here

        this.treeModel = new ComponentTreeModel(new ComponentTreeNode("Components"));
        this.tree = new JTree(this.treeModel);

        // Add a tool tip.
        ToolTipManager.sharedInstance().registerComponent(this.tree);
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() {
            @Override
            public java.awt.Component getTreeCellRendererComponent(JTree t, Object value, boolean sel,
                    boolean expanded, boolean leaf, int row, boolean focus) {
                super.getTreeCellRendererComponent(t, value, sel, expanded, leaf, row, focus);

                ComponentTreeNode node = (ComponentTreeNode) value;
                if (node.getComponentReference() == null) {
                    setToolTipText(null);
                } else {
                    setToolTipText("Drag a component to the composer to add");
                }
                return this;
            }
        };

        // Change icons
        try {
            renderer.setOpenIcon(SwingUtil.createImageIcon("opened.gif"));
            renderer.setClosedIcon(SwingUtil.createImageIcon("closed.gif"));
            renderer.setLeafIcon(SwingUtil.createImageIcon("leaf.gif"));
        } catch (RuntimeException e) {
            logger.warn("Failed to load image icons.  " + "It will use the default icons instead.", e);
        }

        this.tree.setCellRenderer(renderer);
View Full Code Here

    TreeSelectionModel treeSelectionModel = new DefaultTreeSelectionModel();
    treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.typeTree.setSelectionModel(treeSelectionModel);
    JScrollPane treePane = new JScrollPane(this.typeTree);
    contentPane.setLeftComponent(treePane);
    DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
    cellRenderer.setLeafIcon(null);
    // cellRenderer.setIcon(null);
    cellRenderer.setClosedIcon(null);
    cellRenderer.setOpenIcon(null);
    this.typeTree.setCellRenderer(cellRenderer);

    // Set up the feature table.
    this.featureTable = new JTable(new FeatureTableModel());
    JScrollPane featurePane = new JScrollPane(this.featureTable);
View Full Code Here

    this.indexTree.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 2));
    // Only one node can be selected at any one time.
    this.indexTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.indexTree.addTreeSelectionListener(new IndexTreeSelectionListener(this));
    // No icons.
    DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
    cellRenderer.setLeafIcon(null);
    // cellRenderer.setIcon(null);
    cellRenderer.setClosedIcon(null);
    cellRenderer.setOpenIcon(null);
    this.indexTree.setCellRenderer(cellRenderer);
  }
View Full Code Here

    this.fsTree.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 2));
    this.fsTree.setLargeModel(true);
    // Only one node can be selected at any one time.
    this.fsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.fsTree.addTreeSelectionListener(new FSTreeSelectionListener(this));
    DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
    cellRenderer.setLeafIcon(null);
    // cellRenderer.setIcon(null);
    cellRenderer.setClosedIcon(null);
    cellRenderer.setOpenIcon(null);
    this.fsTree.setCellRenderer(cellRenderer);
  }
View Full Code Here

    lastEvent = e;
  }

  public void test(TestHarness harness)
  {
    DefaultTreeCellRenderer r = new DefaultTreeCellRenderer();
    r.addPropertyChangeListener(this);
    harness.check(r.getBackgroundSelectionColor(), UIManager.getColor(
            "Tree.selectionBackground"));
    r.setBackgroundSelectionColor(Color.yellow);
    harness.check(r.getBackgroundSelectionColor(), Color.yellow);
    harness.check(lastEvent, null);
    r.setBackgroundSelectionColor(null);
    harness.check(r.getBackgroundSelectionColor(), null);
    harness.check(lastEvent, null);
  }
View Full Code Here

    lastEvent = e;
  }

  public void test(TestHarness harness)
  {
    DefaultTreeCellRenderer r = new DefaultTreeCellRenderer();
    r.addPropertyChangeListener(this);
    harness.check(r.getBackgroundNonSelectionColor(), UIManager.getColor(
            "Tree.textBackground"));
    r.setBackgroundNonSelectionColor(Color.yellow);
    harness.check(r.getBackgroundNonSelectionColor(), Color.yellow);
    harness.check(lastEvent, null);
    r.setBackgroundNonSelectionColor(null);
    harness.check(r.getBackgroundNonSelectionColor(), null);
    harness.check(lastEvent, null);
  }
View Full Code Here

TOP

Related Classes of javax.swing.tree.DefaultTreeCellRenderer

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.