JTree shows expansion icon when node hasn't got children

When first displayed, my JTree shows the expansion icon next to non-leaf nodes that do not have children.
If I click on one of the expansion icon it disappears.
How can I stop it displaying this in the first place.
i.e. only display it when the node does have children.
Thanks.

I've had a look at the source code to see why this is happening
javax.swing.plaf.basic.BasicTreeUI.paintExpandControl( ... )
seems to be the source of this effect.
It seems that in deciding whether to display expansion icons or not, it ignores whether or not a node has children up until the node is expanded for the first time.
Surely it should consider whether there are children or not from the beginning.
Is this a bug or is there reasoning behind this? If so what? Is there any workaround.

Similar Messages

  • Af:statusIndicator does not show busy icon when a command button is click

    Hi Guys,
    af:statusIndicator does not show busy icon or motion when a command button is click
    I am working on an excel data upload functionality on .jspx page. I use “af:inputFile” file uploader to upload an excel file then process the data and store it as a list of objects in memory and display it in “af:table” table
    I added “af:statusIndicator” to the page to show the user that the page is progressing while the data is uploading and when it is saving the data to the database.
    In this case, when the “af:inputFile” is clicked to upload the excel file - the status indicator shows a progress icon (movement) which is expected and is good. However, after the data have been display in the table when I click on a command button that saves the data to the database – I expected the status indicator to start its busy motion but that is not happening. Whereas, the command button grayed out and is disable when I clicked the button until the operation is completed.
    Is there any way to start the statusIndicator when a command button is clicked?
    I tried the following options
    *<af:statusIndicator id="si1_uploadStatus" partialTriggers="pc1:cb1 pc1:table"/>*
    Where pc1:cb1 is the command button and pc1:table is the table
    *<af:commandButton text="Submit Uploads" id="cb1"*
    *disabled="#{!viewScope.batchUploadController.allSavable}"*
    *partialTriggers="::infFilePath"*
    *action="#{viewScope.batchUploadController.saveUploadedData}"*
    *blocking="true"/>*
    Thanks,

    Can somebody please address this?
    Thanks,

  • Folders won't show some icons when attached to dock

    Hello guys
    I am experiencing a very annoying issue. Turns out that the folders, when put on dock, won't show the icons that are not mac-standard (like .mkv movies, .rar, etc.).
    Here's a screenshot:
    http://i162.photobucket.com/albums/t273/rique333/Screenshot2011-05-21at104346PM. jpg
    Hope you guys know how to fix it.
    Thank you

    I'm not sure if Exchange account settings are made available for transfer to an iPhone via the iTunes sync process.
    Have you tried manually creating your Exchange account on your iPhone using the Exchange account preset?
    If you plan on syncing contact info and calendar events over the air with your Exchange account on your iPhone, all existing contact info and calendar events on your iPhone will be erased and replaced with your online contact info and calendar events at the Exchange server.
    With an Exchange account, you can sync contact info and calendar events direct with Outlook 2003 or 2004 via the iTunes sync process, or you can sync contact info and calendar events over the air. You can do one or the other, not both at the same time.

  • IMac shows global icon when it starts.

    Dear All,
    My iMac suddenly started shows a black & white global icon when it switch on. The icon flashes for almost a minute, and start up page finally appears and OS X enter, everything works alright, but the icon worries me.
    Is that because I made wrong setting?
    Please help. Thanks.
    Alice

    Hi Alice,
    It's not a problem. What you have done is set Network Startup as your startup volume within System Preferences. Do the following:
    1. Fire up System Preferences
    2. Select the Startup Disk icon
    3. Within the Startup Disk preferences select your internal hd (it will be a blue folder marked Mac OS X, 10.4.9 on Macintosh HD or something along those lines).
    That's it. All should be well again.
    RD

  • HT201412 why my ipad briefly shows apple icon when turned on, then displays a picture of a plug, plugging in an itunes circle icon

    lMy ipad would not respond after leaving it for a brief minute.....screen was black, so I plugged it into power source thinking battery needed charging, when I did this, a picture of a plug, plugging into an itunes icon (circle) and nothing else happened.  I pushed button to turn off power, then back on.....at this poing an apple icon came up, went away and the plug showed up again.  Anyone know what I need to do to restart ipad?

    Connect to iTunes on the computer you usually Sync with and “ Restore “...
    http://support.apple.com/kb/HT1414
    If necessary Place the Device into Recovery mode...
    http://support.apple.com/kb/ht4097

  • Link not showing hand icon when mouse over

    I am creating an image gallery and have thumbnails that open
    in a separate window to a larger version of the image.
    The links are working, but when you put the mouse over the
    image the little hand does not appear to show it is a link, if you
    click it works and the image opens, but the hand does not show,
    what have I done wrong.

    This implies that you have applied the behavior directly to
    the <img> tag,
    when you should have applied it to an anchor tag surrounding
    the <img> tag,
    e.g.,
    this - <a href="javascript:;"
    onclick="whatever"><img src="whatever"...></a>
    rather than this - <img onclick="whatever"
    src="whatever"...>
    You can get this by manually creating it, or by selecting the
    image,
    removing the behavior, then entering "javascript:;" (without
    the quotes) in
    the Link field of the Property inspector. This will wrap the
    <img> tag with
    the anchor. Now select the <a> on the Tag selector, and
    apply your
    behavior.
    As you can see, familiarity with HTML (and CSS) will come in
    quite handy
    when working with DW.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "PosterP" <[email protected]> wrote in
    message
    news:g49sdk$gtp$[email protected]..
    >I am creating an image gallery and have thumbnails that
    open in a separate
    > window to a larger version of the image.
    >
    > The links are working, but when you put the mouse over
    the image the
    > little
    > hand does not appear to show it is a link, if you click
    it works and the
    > image
    > opens, but the hand does not show, what have I done
    wrong.
    >

  • Show loading icon when video freezes

    Hi all
    I inserted a video into my movie clip. It freezes sometimes if internet connection is not fast enough but freezes at any frame. I want a loading icon displayed once it stops and disappear when it continues.
    Thank you

    try:
    yourloadingicon.visible=false;
    var fps:Number=stage.frameRate
    var startTime:Number=getTimer();
    this.addEventListener(Event.ENTER_FRAME,f);
    function f(e:Event){
    if(getTimer()-startTime>=1000){
    yourloadingicon.visible=true
    } else {
    yourloadingicon.visible=false;
    startTime=getTimer();

  • Mail shows "offline" icons when online

    I just installed snow leopard and my macmail is now acting very quirky. (10.6.7)
    The "offline" icons appear even when the accounts send and receive mail and the mailboxes "greys out".
    In addition, I get constant requests for passwords in mail (very annoying).
    I have tried different "fixes" mentioned in these forums but all to no avail.
    I'm sure its a glitch in macmail but I sure hope it gets fixed soon!

    Internet is up and running; all is connected.
    Now I'm also getting emails into one mailbox from another of my mailboxes (different domains too!)

  • Icon was changed to default icon when editting a node on JTree

    I have a tree with icon on nodes. However, when I edit the node, the icon is changed to default icon.
    I don't known how to write the treeCellEditor to fix that one.
    The following is my code:
    package description.ui;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.ToolTipManager;
    import javax.swing.WindowConstants;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellEditor;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreePath;
    import javax.swing.tree.TreeSelectionModel;
    public class Tree extends javax.swing.JPanel {
         private JTree tree;
         private JScrollPane jScrollPane1;
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              frame.getContentPane().add(new Tree());
              frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
              frame.pack();
              frame.show();
         public Tree() {
              super();
              initGUI();
         private void initGUI() {
              try {
                   BorderLayout thisLayout = new BorderLayout();
                   this.setLayout(thisLayout);
                   setPreferredSize(new Dimension(400, 300));
                    jScrollPane1 = new JScrollPane();
                    this.add(jScrollPane1, BorderLayout.CENTER);
                        DefaultMutableTreeNode rootNode = createNode();
                        tree = new JTree(rootNode);
                        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
                        jScrollPane1.setViewportView(tree);
                        ToolTipManager.sharedInstance().registerComponent(tree);
                        MyCellRenderer cellRenderer = new MyCellRenderer();
                        tree.setCellRenderer(cellRenderer);
                        tree.setEditable(true);
                        tree.setCellEditor(new DefaultTreeCellEditor(tree, cellRenderer));
                        //tree.setCellEditor(new MyCellEditor(tree, cellRenderer));
              } catch (Exception e) {
                   e.printStackTrace();
         private void btRemoveActionPerformed(ActionEvent evt) {
             TreePath path = tree.getSelectionPath();
             DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)path.getLastPathComponent();
             ((DefaultTreeModel)tree.getModel()).removeNodeFromParent(selectedNode);
         private DefaultMutableTreeNode createNode() {
             DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Doc");
             DefaultMutableTreeNode ch1 = createChuongNode(rootNode, "Ch1");
             DefaultMutableTreeNode ch2 = createChuongNode(rootNode, "Ch2");
             createTextLeafNode(ch1, "title");
             return rootNode;
         private DefaultMutableTreeNode createChuongNode(DefaultMutableTreeNode parent, String name) {
             DefaultMutableTreeNode node = new DefaultMutableTreeNode(new ChapterNodeData(name));
             parent.add(node);
             return node;
         private DefaultMutableTreeNode createTextLeafNode(DefaultMutableTreeNode parent, String name) {
             DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TitleNodeData(name));
             parent.add(node);
             return node;
          private class MyCellRenderer extends DefaultTreeCellRenderer {
                 ImageIcon titleIcon;
                 ImageIcon chapterIcon;
                 public MyCellRenderer() {
                     titleIcon = new ImageIcon(getClass().getClassLoader()
                            .getResource("description/ui/icons/Text16.gif"));
                     chapterIcon = new ImageIcon(getClass().getClassLoader()
                            .getResource("description/ui/icons/Element16.gif"));
                 public Component getTreeCellRendererComponent(
                                     JTree tree,
                                     Object value,
                                     boolean sel,
                                     boolean expanded,
                                     boolean leaf,
                                     int row,
                                     boolean hasFocus) {
                     super.getTreeCellRendererComponent(
                                     tree, value, sel,
                                     expanded, leaf, row,
                                     hasFocus);
                     if (isChapterNode(value)) {
                         setIcon(chapterIcon);
                         setToolTipText("chapter");
                     } else if (isTextLeafNode(value)) {
                         setIcon(titleIcon);
                         setToolTipText("title");
                     return this;
                 protected boolean isChapterNode(Object node) {
                     return ((DefaultMutableTreeNode)node).getUserObject() instanceof ChapterNodeData;
                 protected boolean isTextLeafNode(Object node) {
                     return ((DefaultMutableTreeNode)node).getUserObject() instanceof TitleNodeData;
          private class MyCellEditor extends DefaultTreeCellEditor {
                 ImageIcon titleIcon;
                 ImageIcon chapterIcon;
              public MyCellEditor(JTree tree, DefaultTreeCellRenderer renderer) {
                  super(tree, renderer);
                  titleIcon = new ImageIcon(getClass().getClassLoader()
                         .getResource("description/ui/icons/Text16.gif"));
                  titleIcon = new ImageIcon(getClass().getClassLoader()
                         .getResource("description/ui/icons/Element16.gif"));
              public Component getTreeCellEditorComponent(
                           JTree tree,
                           Object value,
                           boolean isSelected,
                           boolean expanded,
                           boolean leaf,
                           int row) {
                  super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
                  return this.editingComponent;
          abstract class NodeData{
              String name;
              public NodeData(String name) {
                  this.name = name;
              public String getName() {
                  return name;
              public void setName(String name) {
                  this.name = name;
              public String toString() {
                  return name;
          class ChapterNodeData extends NodeData {
              public ChapterNodeData(String s) {
                  super(s);
          class TitleNodeData extends NodeData {
              public TitleNodeData(String attr) {
                  super(attr);
    }

    Arungeeth wrote:
    I know the name of the node... but i cant able to find that nodeHere is some sample code for searching and selecting a node:
        TreeModel model = jtemp.getModel();
        if (model != null) {
            Object root = model.getRoot();
            search(model, root, "Peter");//search for the name 'Peter'
            System.out.println(jtemp.getSelectionPath().getLastPathComponent());
        } else {
            System.out.println("Tree is empty.");
    private void search(TreeModel model, Object o, String argSearch) {
        int cc;
        cc = model.getChildCount(o);
        for (int i = 0; i < cc; i++) {
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(o, i);
            if (model.isLeaf(child)) {
                TreeNode[] ar = child.getPath();
                String currentValue = Arrays.toString(ar);
                if (currentValue.contains(argSearch)) {
                    jtemp.setSelectionPath(new TreePath(ar));
            } else {
                search(model, child, argSearch);
    }

  • Hide the expansion icon on a jtree.

    I need to hide the expansion icon (the "+") on a jtree.
    I tried to use DefaultTreeCellRenderer and the L&F options, but they hide all of the "+" icons of the tree. I need to hide the icons depending if the node has no-leaf icons.
    Thanx.
    pmadridb

    hi,
    you can change the property of common section view attribute. which is default in month. if u use input date component , i think you can overcome your problem..

  • Hi Team, Showing Yellow icons after every 15 to 20 Min and internet stop working.when we enable- disbale the network connection then will internet start working fine.Some time network connection is disable but when we renable that connection it will st

    Hi Team,
    Showing Yellow icons after every 15 to 20 Min and internet stop working.when we enable- disbale the network connection then will internet start working fine.Some time network connection is disable but when we renable that connection it will stuck on enabling
    and will not renable till i am not restart that machine. I have 350 Machine in network but facing this issue in 25 machines. Kindly help me on this issue .
    Regards
    Sahil bhateja

    Hi,
    So switch a LAN card fix this issue...seems a compatibility issue or maybe some packs or programs you installed recently cause this issue.
    Have you manually check the network adapter driver from the PC's manufacture website? sometimes, it will be a time delay before Microsoft push out the driver update.
    Check if issue exists in safemode with network, this mode will launch Windows with limited sets of files and drivers. 
    if you have a restore point, restore the pc to a previous point at which the pc is functioning fine.
    Yolanda Zhu
    TechNet Community Support

  • I recently Updated my phone and my front camera stopped working its pitch black but still shows the icons on the screen but when i get off the app and get back on and flip the camera to my face view it works fine

    I recently Updated my phone and my front camera stopped working its pitch black but still shows the icons on the screen but when i get off the app and get back on and flip the camera to my face view it works fine

    Hi there Fgonzalez2015,
    You may find the camera troubleshooting steps in the article below helpful.
    Get help with the camera on your iPhone, iPad, or iPod touch
    You see a closed lens or black screen
    If you see a closed lens or black screen when you open the Camera app, try these steps:
    Make sure that there’s nothing blocking the camera lens. If you’re using a case, try removing it.
    Force the app to close, then open the Camera app again.
    Restart your device, then open the Camera app again.
    If your device has a front and rear camera, try both cameras by tapping the camera swap icon . If you see the closed lens or black screen on only one camera, take your device to an Apple Retail Store or Authorized Service Provider for more help.
    -Griff W.  

  • My phone keeps resetting and then shows the icon to plug into itunes but when i do itunes tells me that it can't connect to my phone because it has a passcode and wants me to unlock it to connect. My phone only gives me the option to make emergency calls.

    My phone started resetting today over and over and then shows the icon to plug into itunes. When I tried plugging in, a message pops up saying that itunes can't connect because my phone has a passcode and i need to unlock it to connect. my phone won't let me do anything more than make an emergency call. it wont give me the option to enter my passcode to unlock the phone. What can I do?

    After a visit to the apple store, they were able to get through my pass code but unfortunately I found out that is was a problem with the logic board. Since Apple only wants to sell and not fix, I was able to locate an iphone repair near me that deals with logic boards and they are currently working on it right now. i should be getting it back soon. Im not sure if the problem you are experiencing is the same as i went through but it does sound like it may be also a hardware issue and would suggest searching online for an iphone repair place that can diagnose what exactly is wrong. Hope this helps.

  • IPad- on Yahoo pages the mail icon with the red number indication shows email.  When I tap, it asks me to sign in again. I do. It takes me to yahoo mail but there is nothing.  All the folders are emptied. All mail is either read, trash, or deleted.

    iPad- on all Yahoo pages the mail icon with the red number indication shows email.  When I tap, it asks me to sign in again. I do. It takes me to yahoo mail but there is nothing.  All the folders are emptied. All my mail is either read, trash, or deleted. Also, when I tap on the mail app on iPad home page, gmail is no problem but for yahoo I get error: no password for yahoo. Go to Mail Account Settings and enter password.  I'm stuck. Suggestions?  Thank you.

    Ask and you shell receive.....lol
    Go to your Gmail account in the browser.
    Hit the folder icon that brings up the folder selection.
    Scroll down to the bottom and select desktop version.
    The broswer will refresh and bring up your gmail account as though you were looking on it on the computer.
    The go to the upper right corner and select settings.
    Then go to forwarding and pop/imap
    Go look at pop download
    There you'll find 3 numbered lines
    Go to 1. Status
    And select enable pop for all mail
    Then save the settings
    Once you have done that you can go back to BlackBerry device settings and sync your mail or wait for it to sync it's self.
    Let me know how it works out.
    I just did it and it sync within minutes.

  • When I connect my iphone and open itunes the iphone icon shows up but when I click it nothing happens and the icon disappears.  I have uninstalled and re-installed itunes.  Turned my computer off, and turned my iphone off.  Restarted everything.

    When I connect my iphone and open itunes the iphone icon shows up but when I click it nothing happens and the icon disappears.  I have uninstalled and re-installed itunes.  Turned my computer off, and turned my iphone off.  Restarted everything.  Synced my iphone and my itunes and nothing seems to work.  Any suggestions?  I am using Windows

    Stop clicking the eject button.

Maybe you are looking for

  • How to Check whether a table is indexed or not?

    Hi all, I am writing a c++ program where i have to create an Index if Index not exists. Oracle 10.2 is the oracle version and i am using oracle text for indexing. table -- create table xmltable (versionnumber number,instance xmltype); index -- create

  • How can i delete my iCloud account from my iPad without deleting my docs

    I want to get rid of my iCloud account on my iPad but I don't know how to do it m afraid I'm going to delete my docs

  • Reg: Servce Interface in PI 7.1

    Hi Friends I need some clarification regarding the service interface significance in PI 7.1. Actually we can multiple opertions option in SI. What is the eact use and functinality of this . Thanks in Advance Thanks&Regards satya suman

  • Displaying Text in a Dialog Box

    I'm learning Java by reading the book : Java How to Program, 5th edition. Starting chapter 2, all the example programs use windows or dialog boxes to display output instead of display output in the command window. Can someone explain to me why is thi

  • Using Power Query to Update Project Custom Fields

    Is Power Query in Excel 2013 able to do Bi-directional updates for updating Enterprise Custom Project fields in PWA 2013?