Jtree Node with JComboBox don't work properly in Windows Vista!

Hi people!
i create a Jtree component and create a special node, that is a <strong>JPanel with a JLabel + JCombobox</strong>!
Only the direct childs of root have this special node.
A can put this work properly in Windows XP, like the picture:
[XP Image|http://feupload.fe.up.pt/get/jcgd0rY5p9PoFPG]
And in Windows Vista the same code appear like this:
[Vista Image|http://feupload.fe.up.pt/get/Ylajl6hlCUFc0xe]
<strong>Hence, in Vista something append behind the JLabel and show something wyerd!</strong>
I can't understant this and if someone can help i appreciate!
The TreeNodeRender class is :
public class MetaDataTreeNodeRenderer implements TreeCellRenderer {
    private JLabel tip = new JLabel();
    private JPanel panel = new JPanel();   
    private JComboBox dataMartsRenderer = new JComboBox();
    private DefaultTreeCellRenderer nonEditableNodeRenderer = new DefaultTreeCellRenderer();
    private HashMap<String, String> valueSaver = null;
    public MetaDataTreeNodeRenderer(Component treeContainer, HashMap<String, String> valueSaver, String[] valuesComboBox) {
        this.valueSaver = valueSaver;
        int width = (int)treeContainer.getPreferredSize().getWidth();
        panel.setLayout(new GridBagLayout());
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
        panel.setMaximumSize(new Dimension(width, 15));
        panel.setBackground(new Color(255, 255, 255, 0));
        dataMartsRenderer = new JComboBox(valuesComboBox);
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        panel.add(tip, gridBagConstraints);
        gridBagConstraints.gridx = 1;
        panel.add(dataMartsRenderer, gridBagConstraints);
        tip.setLabelFor(dataMartsRenderer);       
    public JComboBox getEditableNodeRenderer() {
        return dataMartsRenderer;
    public String getTipText(){
        return this.tip.getText();
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
            boolean expanded, boolean leaf, int row, boolean hasFocus) {
        Component returnValue = null;
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)value;
        DefaultMutableTreeNode currentNodeFather = (DefaultMutableTreeNode)currentNode.getParent();
        if(currentNodeFather != null && currentNodeFather.isRoot()){//se o meu pai &eacute; a raiz, ent&atilde;o eu sou um datamart
                                                                    //se sou um datamart, ent&atilde;o sou edit&aacute;vel.
            String dataMart = (String)currentNode.getUserObject();
            String dataMartValue = this.valueSaver.get(dataMart);
            tip.setText(dataMart);
            if(dataMartValue != null) {
                dataMartsRenderer.setSelectedItem(dataMartValue);
            returnValue = panel;
        }else{//sou um n&oacute; n&atilde;o edit&aacute;vel.
             returnValue = nonEditableNodeRenderer.getTreeCellRendererComponent(tree,
                     value, selected, expanded, leaf, row, hasFocus);
        return returnValue;
}The TreeNodeEditor class is :
public class MetaDataTreeNodeEditor extends AbstractCellEditor implements TreeCellEditor {
    MetaDataTreeNodeRenderer renderer = null;
    JTree tree;
    //Where i save all JComboBox values ( name of label, selected item in combobox), for all combbox
    HashMap<String, String> valueSaver = null;
    public MetaDataTreeNodeEditor(JTree tree, Component treeContainer, HashMap<String, String> valueSaver, String[] valuesComboBox) {
        this.tree = tree;
        this.renderer = new MetaDataTreeNodeRenderer(treeContainer, valueSaver, valuesComboBox);
        this.valueSaver = valueSaver;
    public Object getCellEditorValue() {
        JComboBox comboBox = renderer.getEditableNodeRenderer();
        String dataMart = renderer.getTipText();
        this.valueSaver.put(dataMart, (String)comboBox.getSelectedItem() );
        return dataMart;
    @Override
    public boolean isCellEditable(EventObject event) {
        boolean returnValue = false;
        if (event instanceof MouseEvent) {
            MouseEvent mouseEvent = (MouseEvent) event;
            if (mouseEvent.getClickCount() > 1) {
                TreePath path = tree.getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
                if (path != null) {
                    Object node = path.getLastPathComponent();
                    if ((node != null) && (node instanceof DefaultMutableTreeNode)) {
                        DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node;
                        if ( treeNode.getParent() != null && ((DefaultMutableTreeNode) treeNode.getParent()).isRoot()) {
                            returnValue = true;
                        } else {
                            returnValue = false;
        return returnValue;
    public Component getTreeCellEditorComponent(final JTree tree, final Object value, boolean selected,
            boolean expanded, boolean leaf, int row) {
        Component editor = renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf,
                row, true);
        ActionListener actionListener = new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                if (stopCellEditing()) {
                    fireEditingStopped();
        if (editor instanceof JPanel) {
            Object component = ((JPanel) editor).getComponent(1);
            JComboBox field = (JComboBox) component;
            field.addActionListener(actionListener);
        return editor;
    }

Hi people!
i create a Jtree component and create a special node, that is a <strong>JPanel with a JLabel + JCombobox</strong>!
Only the direct childs of root have this special node.
A can put this work properly in Windows XP, like the picture:
[XP Image|http://feupload.fe.up.pt/get/jcgd0rY5p9PoFPG]
And in Windows Vista the same code appear like this:
[Vista Image|http://feupload.fe.up.pt/get/Ylajl6hlCUFc0xe]
<strong>Hence, in Vista something append behind the JLabel and show something wyerd!</strong>
I can't understant this and if someone can help i appreciate!
The TreeNodeRender class is :
public class MetaDataTreeNodeRenderer implements TreeCellRenderer {
    private JLabel tip = new JLabel();
    private JPanel panel = new JPanel();   
    private JComboBox dataMartsRenderer = new JComboBox();
    private DefaultTreeCellRenderer nonEditableNodeRenderer = new DefaultTreeCellRenderer();
    private HashMap<String, String> valueSaver = null;
    public MetaDataTreeNodeRenderer(Component treeContainer, HashMap<String, String> valueSaver, String[] valuesComboBox) {
        this.valueSaver = valueSaver;
        int width = (int)treeContainer.getPreferredSize().getWidth();
        panel.setLayout(new GridBagLayout());
        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
        panel.setMaximumSize(new Dimension(width, 15));
        panel.setBackground(new Color(255, 255, 255, 0));
        dataMartsRenderer = new JComboBox(valuesComboBox);
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        panel.add(tip, gridBagConstraints);
        gridBagConstraints.gridx = 1;
        panel.add(dataMartsRenderer, gridBagConstraints);
        tip.setLabelFor(dataMartsRenderer);       
    public JComboBox getEditableNodeRenderer() {
        return dataMartsRenderer;
    public String getTipText(){
        return this.tip.getText();
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
            boolean expanded, boolean leaf, int row, boolean hasFocus) {
        Component returnValue = null;
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)value;
        DefaultMutableTreeNode currentNodeFather = (DefaultMutableTreeNode)currentNode.getParent();
        if(currentNodeFather != null && currentNodeFather.isRoot()){//se o meu pai &eacute; a raiz, ent&atilde;o eu sou um datamart
                                                                    //se sou um datamart, ent&atilde;o sou edit&aacute;vel.
            String dataMart = (String)currentNode.getUserObject();
            String dataMartValue = this.valueSaver.get(dataMart);
            tip.setText(dataMart);
            if(dataMartValue != null) {
                dataMartsRenderer.setSelectedItem(dataMartValue);
            returnValue = panel;
        }else{//sou um n&oacute; n&atilde;o edit&aacute;vel.
             returnValue = nonEditableNodeRenderer.getTreeCellRendererComponent(tree,
                     value, selected, expanded, leaf, row, hasFocus);
        return returnValue;
}The TreeNodeEditor class is :
public class MetaDataTreeNodeEditor extends AbstractCellEditor implements TreeCellEditor {
    MetaDataTreeNodeRenderer renderer = null;
    JTree tree;
    //Where i save all JComboBox values ( name of label, selected item in combobox), for all combbox
    HashMap<String, String> valueSaver = null;
    public MetaDataTreeNodeEditor(JTree tree, Component treeContainer, HashMap<String, String> valueSaver, String[] valuesComboBox) {
        this.tree = tree;
        this.renderer = new MetaDataTreeNodeRenderer(treeContainer, valueSaver, valuesComboBox);
        this.valueSaver = valueSaver;
    public Object getCellEditorValue() {
        JComboBox comboBox = renderer.getEditableNodeRenderer();
        String dataMart = renderer.getTipText();
        this.valueSaver.put(dataMart, (String)comboBox.getSelectedItem() );
        return dataMart;
    @Override
    public boolean isCellEditable(EventObject event) {
        boolean returnValue = false;
        if (event instanceof MouseEvent) {
            MouseEvent mouseEvent = (MouseEvent) event;
            if (mouseEvent.getClickCount() > 1) {
                TreePath path = tree.getPathForLocation(mouseEvent.getX(), mouseEvent.getY());
                if (path != null) {
                    Object node = path.getLastPathComponent();
                    if ((node != null) && (node instanceof DefaultMutableTreeNode)) {
                        DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) node;
                        if ( treeNode.getParent() != null && ((DefaultMutableTreeNode) treeNode.getParent()).isRoot()) {
                            returnValue = true;
                        } else {
                            returnValue = false;
        return returnValue;
    public Component getTreeCellEditorComponent(final JTree tree, final Object value, boolean selected,
            boolean expanded, boolean leaf, int row) {
        Component editor = renderer.getTreeCellRendererComponent(tree, value, true, expanded, leaf,
                row, true);
        ActionListener actionListener = new ActionListener(){
            public void actionPerformed(ActionEvent e) {
                if (stopCellEditing()) {
                    fireEditingStopped();
        if (editor instanceof JPanel) {
            Object component = ((JPanel) editor).getComponent(1);
            JComboBox field = (JComboBox) component;
            field.addActionListener(actionListener);
        return editor;
    }

Similar Messages

  • My GX630 doesnt work properly on Windows Vista 64 bit

    Hi,
      I have problem with my GX630, its doest work properly at W Vista 64 bit, exactly Sleep mode ... its imposible to awake my computer nd I have to turn it off and than on to wake it up ...
      those buttons Turbo nd Eco mode doesnt work.
      sometimes happen that i get blue error screen and reset but I dont know why ... it wrotes something with some .dll file ...
    some people told me that its error is caused by that thing that there are no drivers for 64 vista yet ...
    I would be pleased if someone could help me up to this topic or to my email (removed to protect user privacy) or ICQ (115-378-414)  thank to all of you Jabu

    "sometimes happen that i get blue error screen and reset but I dont know why ... it wrotes something with some .dll file ... "
    What is the BSOD error code? What .dll ? Write down the exact error.
    Do you OC your notebook?
    "some people told me that its error is caused by that thing that there are no drivers for 64 vista yet ... "
    Install Drivers from MSI web:
    http://global.msi.eu/index.php?func=downloaddetail&type=driver&maincat_no=135&prod_no=1513
    "those buttons Turbo nd Eco mode doesnt work."
    You need SCM: http://global.msi.eu/index.php?func=downloaddetail&type=utility&maincat_no=135&prod_no=1513
    But x64 bit is N/A.
    Why you use x64bit version anyway? Why not 32bit?

  • TB display devices don't work properly under windows

    I went out and picked up a TB display last night to pair with my 2011 mbp. I live in windows about 80% of the time and expected there to be no issues with the basic usb hub built into the display – unfortunately that does not seem to be the case. My Apple usb keyboard (also brand new) and dell usb mouse both hang/freeze/work erratically when connected to the back of the display, as does my Jabra pro headset.
    I can make the behavior 10 times worse simply by using hardware built into the display, such as the display's facetime camera. If I fire up Lync and start a video chat, my keyboard and mouse become nearly unusable. My basic testing under Lion appears to confirm this is an issue with Apple’s boot camp drivers as things work properly under OS X. Problem occurs both with win7 and win2008r2, I have rebuilt both OSes twice to confirm.
    The firmware/drivers of the display itself appear to be the problem.  The peripherals work fine plugged directly into the laptop.  Thunderbolt itself appears to be the root of the issue, as the facetime camera exhibits the same pauses/lags even with no peripherals plugged into the display (unless the facetime cam is a usb device and not a pci-e device, in which case perhasp the usb implementation is to blame).  Hope there will be a firmware/driver fix soon.

    I have marked this as answered as it was more a post to help others who may have experienced the same problem I did and didn't get a reply or just didn't know that this program could be the reason their Windows Mail has issues that can't seem to be resolved any other way apart from ignore them and hope they don't get worse.

  • MP3 created with iTunes don't work properly

    Hi, I have a strange problem. If I import a CD using my MAC and iTunes, creating MP3 files, then copy to my USB stick to play in my car, it only plays the 1st song, then skips through all others and plays the 1st song of the next album. If I do the same import of a CD on my Vista PC using iTunes (same version) and create MP3 files, copy to the same USB stick and play in my car, all is ok.
    Can anyone help to explain this? It's very annoying considering I have 1000s of MP3 created on my MAC.
    regards
    G.

    Start here:
    iPhone, iPad, or iPod touch: Device not recognized in iTunes for Windows
    The exact wording of the error message wold have been useful.

  • The sites I make with iWeb don't work well on Windows!

    I've made a site with iWeb 08 and it works fine with Safari, and at times with Firefox.
    However, it has some "glitches" when you use Internet Explorer on a Windows based computer.
    Especially the "Search" button.
    Has anyone noticed this? Is there a fix?
    I'd like all type of users to view this site, not just Mac users.

    IE (especially versions 6 and below) are notoriously non-compliant. There is not much you can do if your visitors are using IE other than place a small warning on your site that says something along the lines of 'Best Viewed in FF or Safari, although strictly speaking this is against accessibility guidelines and not good web design practice.
    You could try and incorporate a bespoke Google search into your site as a replacement.
    Hope that helps
    AAi

  • Google maps don't work properly with ADF

    Hi!
    I have tried to integrate Google maps with ADF http://blogs.oracle.com/middleware/2010/06/integrating_google_maps_with_adf.html. This tutorial works good, but then I insert the same code in real ADF application Google maps don’t work properly, there are problems with zoom buttons, map doesn’t display right region but shows another one (does it with offset) etc.
    Can be this issues connected with ADF Security? Or there are some other things in my project which doesn’t allow JavaScript to work correctly?

    andrejs,
    I just tried the tutorial (works fine) and the tutorial with ADF security (works fine). It seems to be something more specific to your application than anything else.
    John

  • Desktop SMS and Windows Mail don't work properly together

    Hi
    thought I would post there here as been having some issues with my Windows Mail but my desktop computer doesn't suffer same issues and on a Vista forum where I posted my problem a couple of very helpful told me who to try solving the issues.
    One of them suddenly realised I'd said my laptop was a Toshiba and apparently the Desktop SMS and Windows Mail just don't work properly together so the person suggested unless I use it to uninstall it apparently amongst the technically trained its known that these two programs don't like each other and would explain why my desktop doesn't have the issue but laptop does.
    After resetting the Windows Mail (tutorial on a vista site http://www.vistax64.com/tutorials/) Touch wood don't be put off by vistax64 as site does both 32 and 64 and followed Brink's excellent resetting Windows Mail (didn't restore any mail) and then uninstalled Desktop SMS and touch wood no more mail issues as has been giving me problems virtually daily with marking draft emails as read/sent.
    So had to click on forward then delete those bits and finish email to send it and touch wood since doing these two things as soon as send an email to draft or outbox get the number of emails in the brackets whereas before this wouldn't happen unless I closed the program then reopened it.
    Hoping these solutions have fixed my problem and wanted to share it with anybody else who wants to read this thread and would recommend the Vista 64 site as they're all really helpful over there and speak in non technical terms for those of us not technically trained.
    Debbie

    I have marked this as answered as it was more a post to help others who may have experienced the same problem I did and didn't get a reply or just didn't know that this program could be the reason their Windows Mail has issues that can't seem to be resolved any other way apart from ignore them and hope they don't get worse.

  • I just started having an issue with my bank website working properly. They have told me it is because of the last safari upgrade. Is this being resolved?

    I just started having an issue with my bank website working properly. They have told me it is because of the last safari upgrade. Is this being resolved?

    You might want to consider "voting with your feet" and taking your business to another bank.  When they tell you the upgrade is the problem, it is really their problem and not yours.  If you don't want to do that, the suggestion that you try another browser is absolutely correct.

  • The Proximity sensor don't work properly of ios4

    hello! ive just update to ios 4 on my 3gs, and the problem is that the Proximity sensor don't work properly, when I put the iPhone near my ear it turns off the screen, but when I move it back from my ear it doesn't turn on...
    i tried to restore, and at first the problem was gone, and now it's back...
    is it a bug? I'm pretty sure my sensors are fine..
    tnx!

    I was having the same issue with my new iphone 4 with screen going dark when I lowered it during a call & not having access to the call or controls of the phone. I discovered the problem was the 3G case I was using on my iphone 4 (it happens to fit pretty well). When I removed the case the proximity sensor now seems to function properly. The 3G case must have been interfering with the sensor. I guess I'll be getting a new case. Hope this helps.

  • ID3v2 tags don't work properly on zen microph

    I e-mailed tech support on this one, but it seemed like they spent 2 seconds reading it and then sending a template reply.
    I have a lot of older mp3 files which I only used ID3V2 tags on, because that was the field with most info when right-clicking files in winamp.
    When I try looking for a file which only has id3v2 tags, things don't work properly. Let's say I have this info in the id3v2 tag: "Mr.Artist - Mr. Track - Mr.Album".
    Now let's turn the player on. Artists: "Mr.Artist" shows. When clicking on "Mr.Artist", "Mr.Album" shows. BUT, when clicking on the album, where the hell is "Mr. Track"? I only see blank space! I have to click "all tracks" and scroll my way to "mr. track" to find it.
    This is a highly unneccesary hassle. I've updated the firmware, but that didn't do anything at all. I download a lot of unsigned, free music, which only has id3v2 information in it.
    Id3v tags on the other hand, work just like they should.
    Please help me out on this one. It would be greatly apreciated.Message Edited by Rognalf on 06-09-20070:57 AM
    Message Edited by Rognalf on 06-09-2007:00 AM

    From my own experience it seems that ID3v2 tags seem to cause problems like this with most mp3 players. I'm guessing because it's newer. I've heard that ID3v2 is more flexible but ID3v is more compatible.

  • Edge animations don't work properly in DPS.

    I've recently update CC to the latest 2014 version and since then Edge animations don't work properly in DPS (struggle to load and play). Can anyone help?

    Hi Bob,
    What real details do you need? I create a digital magazine using DPS with the occasional Edge oam file inserted to lift a couple of the openers. However recently, they either stutter on loading, don't load or crash the viewer/ipad. I test them in Content viewer.
    Thanks
    Mat

  • Cookies Don't Work Properly

    OK, I've looked through this Forum carefully and tried everything.... Even though cookies for certain web sites (NYTimes, WatchGeeks) appear in Safari Preferenes they don't work, Why?
    My settings are as follows: Block Cookies from Third Parties, etc.; Prompt from website one time only. The NYTimes cookie indicates Cache, Cookies & Local Storage. NYT cooke indicates Cookie. But every time I go from one page to another on their site, the sign-in screen re-appears. I'm using Last Pass to sign me in and I'm good until i go to another page. Then the same thing happens. With WatchGeeks, I'm prompted to sign it every time I return to the site...same problem.
    I have deleted all cookies and started over, but that doesn't solve the problerm. Safari recognizes and stores the cookies again, but they don't work properly.This all started when I started to use  'Cookie" a cookie management program. But once this started, I uninstalled "Cookie'" and removed all traces of it, to no avail.
    What's wrong? Can I do something in Time Machine to get me back on track? I'm open to any and all suggestions. Thanks!

    You can check on the <b>about:config</b> page if the javascript.enabled pref is set to true.
    *http://kb.mozillazine.org/about:config
    You can try basic steps like these in case of issues with web pages:
    Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and the cookies from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Why am I facing so many problem after upgrading to ios7, my phone hangs/stuck many times, applications just stop working and close themselves, battery drainage,Facebook and all applications don't work properly. What should I do? They punished me for upgra

    I'm using iPhone 5
    Why am I facing so many problem after upgrading to ios7, my phone hangs/stuck many times, applications just stop working and close themselves, battery drainage,Facebook and all applications don't work properly. What should I do? They punished me for upgrading to ios7. I now hate apple and I'm thing of getting samsung.

    Basic troubleshooting
    Reset
    Restore with backup
    Restore as new ( better )

  • How do I get sounds back? I don't know when an email arrives and my apps with songs don't work

    How do I get my sounds back? My apps with songs don't work and I don't know when a message or email arrives.
    Thanks

    Is it on mute? There is a switch on the side which may be mute or rotation lock. If it locks the rotation, double tap the home button and swipe your finger to the right. You should see volume, brightness, etc... On the far left is a button to mute or lock rotation. Make sure it is not on. If you still can't hear anything, go to settings> general> sounds> ringer and alerts and slide the dot to the right.
    Hope this helps!
    Caleb.

  • Since last upgrade (tablet under Android), websites with frames don't work.

    All apps are up to date. Since last Firefox upgrade, web sites with frames no longer work properly : frames are outside of screen at bottom. Chrome and other browsers work fine... but I prefer Firefox.

    I view this page from home web page ([http://www.ville-fondettes.fr/ http://www.ville-fondettes.fr/] ), staying in Firefox app.
    This web site isn't very well designed but was working well with previous version of Firefox.
    I found other web sites but a private account is needed. I try to find other examples with the same issue.

Maybe you are looking for

  • How to upload a PDF online, fill it, then save?

    Hi, I'm trying to figure out on how to upload a PDF to our own server (thru an FTP site) so users can fill it in, then save it to their computer's hard drive/desktop. i searched all over and cannot find a solution. Can someone please help? Thank you

  • Automatic Data Transfer

    Hi everyone, I am trying to create an automatic control for checking automatic data transfer settings calibration for transfer data from SAP-FI to SAP BPC. Any idea of how to design it? Is there a tabla containing information about the complete trans

  • How to know logical database supports Dynamic Selections

    hi all, 1. Logical database KDF supports Dynamic Selections 2. How to know logical database 'KDF' supports Dynamic Selections

  • Want hyperlinks viewable in PDF but NOT TO PRINT

    I am creating a booklet with hyperlinks (really just to other pages in the document) and I want to make a button on every page to return to the TOC. However, I don't want this button to show up when the user prints the PDF. I have tried all kinds of

  • Every time I eject my Ipod from ITunes 7, it erases everything

    Every time I eject my ipod (with clickwheel) from ITunes 7 after updating, it takes a long time, and then when it finally ejects, all my songs are erased from the ipod. When I reconnect to my iBook, I have to restore the ipod... every time! After the