How do you build a JTree with no root whatsoever (or its placeholder space)?

Discussion in 'Java' started by lbrtchx, Aug 9, 2007.

  1. lbrtchx

    lbrtchx Guest

    Check out Marti Hall's examples at:
    ~
    http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JTree.html
    ~
    on the last example "5.2. Replacing the Icons: Result"
    ~
    if you declare your root node like this:
    ~
    root = new DefaultMutableTreeNode();
    ~
    you wont get any label for the root object, but some space shows
    there anyway
    ~
    How do you rid the space too?
    ~
    THanks
    lbrtchx
     
    lbrtchx, Aug 9, 2007
    #1
    1. Advertisements

  2. Jtree.setRootVisible(false);
     
    Sabine Dinis Blochberger, Aug 10, 2007
    #2
    1. Advertisements

  3. lbrtchx

    lbrtchx Guest

    ~
    Well, this would also erase the little lines representing connections
    to the tree's "Root". Is there a way to only get rid of the space
    left?
    ~
    lbrtchx
     
    lbrtchx, Aug 11, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.