JCheckBox as nodes in JTree having problems with custom renderer and editor

Ok, let me give some background. I have an XML document that I am parsing and reading in as a JTree. Works fine.
Next, I have overwritten the DefaultTreeCellEditor to return a JCheckBox and in this implementation of the getTreeCellEditorComponent(), I actually tell the node that he is selected. Works great.
Next, I have overwritten the DefaultTreeCellRenderer to return a JCheckBox and in the implementation of the getTreeCellEditorComponenet, I actually check to see if the Node is selected in the tree based upon the isSelected state of the actual Tree Node set in the tree cell editor, and if so, I set the JCheckBox to selected(true).Works Great.
Now, here is the issue. If a node in the tree is selected that contains children, then I want all of the children of that node to also be selected. However, when I select a node with children only the selected node is changed, and then a few moments later, the system repaints the entire tree and ALL nodes int the tree are set to a selected state. Strange? Yes. Any ideas?? WONDERFUL!! :)
Here is the TreeCellEditor code:
public Component getTreeCellEditorComponent(JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
elementCheckBox_ = new JCheckBox();
Component result = null;
System.out.println("isSelected? Editor = " + isSelected);
TreePath newPath = tree.getPathForRow(row);
System.out.println("value = " + value.getClass().toString());
if(value instanceof IMarketTreeNodeElement)
if(isSelected)
if(((IMarketTreeNodeElement)value).isSelected())
((IMarketTreeNodeElement)value).setSelected(false);
else
((IMarketTreeNodeElement)value).setSelected(true);
elementCheckBox_.setSelected(isSelected);
return elementCheckBox_;
Here is the TreeCellRenderer code:
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Color colSelBorderCol = UIManager.getColor
("Tree.selectionBorderColor");
selBorder_ = BorderFactory.createLineBorder(colSelBorderCol, 1);
normBorder_ = BorderFactory.createEmptyBorder(1,1,1,1);
elementCheckBox_.setText(value.toString());
if(selected)
elementCheckBox_.setSelected(selected);
elementCheckBox_.setForeground(Color.YELLOW);
elementCheckBox_.setBackground(Color.RED);
else
elementCheckBox_.setForeground(tree.getForeground());
elementCheckBox_.setBackground(tree.getBackground());
if (hasFocus)
elementCheckBox_.setBorder(selBorder_);
else
elementCheckBox_.setBorder(normBorder_);
return elementCheckBox_;
Here is the Node Code setting all child nodes to selected:
public void setSelected(boolean selected)
isSelected_ = selected;
if(isSelected_)
if((this.getTagName() == "MARKET") ||
(this.getTagName() == "TIER") &&
(this.getChildCount() != 0))
selectChildren(true);
else
if((this.getTagName() == "MARKET") ||
(this.getTagName() == "TIER") &&
(this.getChildCount() != 0))
selectChildren(false);
public boolean isSelected()
return isSelected_;
public void selectChildren(boolean selected)
int children = getChildCount();
for(int i = 0; i < children; i++)
IMarketTreeNodeElement elem = (IMarketTreeNodeElement)
this.getChildNodes().item(i);
isSelected_ = selected;
Thanks for any help! :-)

I tried to run your sample code and it won't compile. The header files:
#include
#include
#include
#include
#include
do not exist on my install of MeasurementStudio. I am a bit suspicous that I don't have the latest and greatest (loading the dialong resouce gave version warnings). Here is one of my header file headers:
//==============================================================================
// Title : NiAxes3d.h
// Copyright : National Instruments 1999. All Rights Reserved.
// Purpose : Defines the CNiAxes3D class.
//==============================================================================
I
looked on your updates site and don't really see an update that applies to ComponentWorks or MeasurementStudio. My version per the MAX program for 3DControls is 3.5.549.
Do I need a newer version? What do I have to do to get the updated version? What does it cost?
Chuck

Similar Messages

  • JTree selection problem when using custom renderer and editor

    Hello:
    I created a JTree with custom renderer and editor.
    The customization makes JCheckBox to be the component
    responsible for editing and rendering.
    The problem is that when I click on the node with the checkbox
    the JTree selection model does not get updated.
    Without customizations of the editor and renderer the MouseEvent would be fired and BasicTreeUI$MouseHandler.mousePressed() method would call
    the selectPathForEvent() method which would be responsible for updating
    the selection model. At the same time if I attach a mouse listener to the JTree (customized) I see the events when clicking on the nodes. It seems like the MouseEvent gets lost and somehow as a result of which the selection model does not get updated.
    Am I missing something?
    Thanks
    Alexander

    You probably forgot to call super.getTreeCellRendererComponent(...) at the beginning of your getTreeCellRendererComponent(...) method in your custom renderer.
    Or maybe in the getTreeCellEditorComponent(...) of the TreeCellEditor...

  • I'm having problems with 8.1 and Continuity / Handoff. It will work fine for web pages, etc. but in email when I try to do it between by iPhone 5s running 8.1 and my Macbook Pro running Yosemite I consistently get an error.

    I'm having problems with 8.1 and Continuity / Handoff. It will work fine for web pages, etc. but in email when I try to do it between by iPhone 5s running 8.1 and my Macbook Pro running Yosemite I consistently get an error. "Failed to Continue Activity" Cocoa Error 4609.  Handoff is working for phone calls and text messages. By email just crashes each time. It was also doing it under 8.0.2.  My iPhone and iPad handle this fine. It's only the MacBook to the iPhone that fails, and only on email.

    Handoff Continuity Troubleshooting

  • Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Having problems with ipad mini and Siri. Works sporadically, will work once and then the second time not. Worked all the time with the original Mailbox app. Then started doing the same thing when I installed the new update so wondering if it is software?

    Hi,
    I have the check box on a second Partition  but not on the Time Machine one
    I forget what I did now to get this called "Recovery HD"
    For the rest try https://discussions.apple.com/docs/DOC-4055  User Tip that links to Pondini's work on Time Machine.
    10:17 pm      Friday; May 2, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • I'm having problems with iPad 2 and my smart cover.  The attachment seems to be depolarized and it moves around causing the device to toggle and flash like its coming on or shorting.  Anyone having problems?

    I'm having problems with iPad 2 and my smart cover.  The attachment seems to be depolarized, trys to connect using the back (curved) edge of the magnetized bracket.  When I try to attach it, it moves around causing the device to toggle in a way that looks like the camera flash.  Anyone having problems? Help.

    Update. My carrier says the antenna of my iPhone 4s is not so good as the one in the iPhone 3G. They can't solve the problem. Their signal is too weak for the 4s at places I spend most of my time. Not the answer I expected, but I'm free to choose an other carrier. Hope this will help.
    This was not the correct answer, I accidentially clicked the button..
    Message was edited by: vasch

  • Hi im having problems with my internet and email ive reset the network even with my wifi on ive also turned off and on airplane mode help please thank you

    hi im having problems with my internet and email Ive reset the network even with my WiFi on Ive also turned off and on airplane mode help please thank you

    hi Ive reset my network toggled the airplane on and off and turned off my carrier off then turned my phone off and turned my carrier back on but still problem persists

  • Since upgrade to ios6 l have been having problem with wifi connection and connecting to App Store and iTunes store

    Q since upgrade to iOS6 l have been having problem with wifi connection and getting into App Store and itunes

    Saw this on another post.
    Applecare Senior Advisor Txx Bxxx (I have his contact info in an email he just sent) just confirmed with me that the problem people are having with the App Store not loading is an apple issue with there servers, ITS NOT YOUR IPAD so don't go restoring it!   It's not happening to everyone however but they are looking into it, its really hit or miss.
    In the meantime ...........
    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
    ~~~~~~~~~~~~~~~~
    iOS 6 Wifi Problems/Fixes
    Fix For iOS 6 WiFi Problems?
    http://tabletcrunch.com/2012/09/27/fix-ios-6-wifi-problems/
    Did iOS 6 Screw Your Wi-Fi? Here’s How to Fix It
    http://gizmodo.com/5944761/does-ios-6-have-a-wi+fi-bug
    How To Fix Wi-Fi Connectivity Issue After Upgrading To iOS 6
    http://www.iphonehacks.com/2012/09/fix-wi-fi-connectivity-issue-after-upgrading- to-ios-6.html
    iOS 6 iPad 3 wi-fi "connection fix" for netgear router
    http://www.youtube.com/watch?v=XsWS4ha-dn0
    Apple's iOS 6 Wi-Fi problems
    http://www.zdnet.com/apples-ios-6-wi-fi-problems-linger-on-7000004799/
    ~~~~~~~~~~~~~~~~~~~~~~~
    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    WiFi Connecting/Troubleshooting
    http://www.apple.com/support/ipad/wifi/
    How to Fix: My iPad Won't Connect to WiFi
    http://ipad.about.com/od/iPad_Troubleshooting/ss/How-To-Fix-My-Ipad-Wont-Connect -To-Wi-Fi.htm
    iOS: Connecting to the Internet
    http://support.apple.com/kb/HT1695
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • I am having problems with Time Machine and having enough space to finish my last back up.

    I am having problems with Time Machine and having enough space to finish my last back up.

    Take a look at this link, http://support.apple.com/kb/HT1427

  • Problems with Customer Service AND unexplained charges!

    I've been with Verizon for I-don't-know-how-many years, and through the years you are bound to have a few problems here and there but some of the problems are just ridiculous! It's also the same reocurring problem!!!!!!!!!!!!!!!! I was with Alltel first, before it was bought out by Verizon. The years I was with Alltel, I didn't have near as many problems. It seems EVERY time I do the smallest change or something to my phone or bill, I get a ridiculous amount of charges that I was NOT aware of, nor told about... EVEN IF I ask "So this isn't going to change my bill, or there will not be any unexpected/unexplained charges that I don't know about?"... BUT not matter how many times I ask... and NO matter how many times I am told "no"... there always is. For example.... last year, I updated and signed a new 2 year contract and purchased the first Driod. Before, my 30 day warranty was up, I was having problems with my Driod, and decided to send it in and get a new one. Before I did this.. I called customer service to make sure there would be no interuption in my bill, and there wouldn't be any unexpect charges, and there would be no difference in anything. I was told there was not, and once I recieved my new phone, just send it in and nothing would be changed. Of course, when I get my bill.. I see I was charged $500 for the new phone. It was explained to me that my credit card was reimbursed (which I never check that card, because I never used it expect to purchase the phone) and that I was recharged for the new phone, since it was a new phone. So I had to fork out the $500 (on top of my bill) and then wait months to get the $100 rebate card. Months after that, I "assumed liablity of my line" because I was on a plan with my family. I decided to have my own line, so I "assumed liability." I was not told that when I did that, I "renewed" my contract date. So I just added 6 more months to my 2 year contract. Was NOT told about that! Then again...... I was recently having problems with my Driod (the screen went black and would not come back on.) I had to turn on an OLD motorola razor, so I would not be without a phone for two days while I was waiting on my phone to come in. As soon as my phone came in, I had my Droid turned back on. I recieved my bill recently, and my bill was $200 over what it normally should be.... so I called in... apparently, when I had my phone replaced, they dropped off my data package and when I recieved my replacement driod, they never put it back on. So I was being charged for alllll my data usage... again I was NOT told about this. I wasn't even aware that they had dropped off my data package, and when/where did they get the authority to do that??? These are just a FEW of the problems that I have had.................................
    Does anyone have these reoccuring problems!?

    I understand that my bill can be viewed online, and I do view it fairly regularly, so if there are any unexplained charges, I can call Verizon asap. The problem does not come from me not understanding my bill, but from customer service. I have been with Verizon for a very long time, and it is a continuing problem. Where did Verizon get the 'OK' to drop my data package off my plan? Who authorized that?
    After calling Verizon and trying to find out the problem, the gentleman told me that when I activated on old phone while I was waiting on my new Droid to arrive, my data package was dropped off and I "should" have been told about that. When I reactiviated my new Droid, I "should" have called and had them restart my data package. I was not aware that when you activate an old phone that data plan is taken off your plan. In all my years of having cell phones, I never make two years with one phone. I have always, at one point, had to turn on an old phone, and my data package has NEVER changed. Why would I have my data package dropped and why would I have to call Verizon to have it restarted. I would never know to do that unless I was TOLD that my data packaged HAD to be re-added when I recieved my new phone, but I was never told of that.
    All of that is beside the point, the point is, Verizon was never given the authorization to change my plan. Never. My bill was taken care of and readjusted, and I am thankful for that. It does not change the fact it is always a hassle with Verizon Customer Service and I am always the one having to PROVE that I am not at fault, or that I was NEVER told of certian things. EVERY TIME I HAVE CALLED CUSTOMER SERVICE, I AM TOLD "I'M SORRY, THEY SHOULD HAVE TOLD YOU THAT."
    "they should" does not help my bill with the extra armount of charges.

  • Anyone NOT having problems with ITunes 8 and latest firmware update???

    I have really been put off updating to ITunes 8. The firmware update appears to be doing well. Is there anyone that uses a MacBook like myself who have had absolutely NO problems with new Itunes and firmware update? Answers on the back of a £50 note....

    Not having issues now that I have updated all i(hardware) firmware to version 2.1, two phones and an iPod Touch, all work fine (So Far) (knocking on wood). As far as iTunes goes I have mixed feelings. It's a bit faster and more stable, however they removed the "Burn CD" ability from the software. That blows a bit as I would make CD's from some of my play lists to play in the car. Yes I can dock my devices in the car, but as a matter of convenience it's easier to fire up the CD when your in a rush.

  • Im having problems with my illustrator , and i don't know how to fix it?

    hey, guys. um my illustrator is having this problem with the navigator . and its makiing this fat lines and when i click the line on the little box in the bottom
    and put it at 100 % it comes out like this
                               all small and i dont understand why is doing this.
    can tou guys please help me with this i have a big project due and i cant work with this like it is ...>!!!!!

    You can change your artboard size without having to make a new document.
    1. Click on the Artboard Tool
    2. In the top menu, you can type new dimensions. Make sure to type in the correct units!

  • Having problems with front row (and the opticle drive)

    I bought my macbook three days ago, and I'm already having problems. First off, I transfered music from my user profile on my old iMac G5 to the macbook via data DVD. My music collection had some purchaces from the itunes store, so I had to go through the authorization thing, and I can now play them just fine in the iTunes library, but the problem is, if I try to use the front row program to play my purchaced music, I get the message saying that I have to authorize it first. What the ****? Does anybody else have this problem? Also, like many other macbook users, I'm having problems with the opticle drive, such as getting cds to be recognized and other things of that nature.

    I noticed that this problem started after I tried to use a software to unlock my drive's region...
    I believe this is the problem. The VLC Media Player will usually play DVDs from other regions without changing the settings on your optical drive. You may need to reset your optical drive's firmware back to the original setting, make sure you have the region set for the one you'd prefer to use the most and then use VLC to play the other DVDs.
    -Doug
    P.S. After two years in the Front Row forum, I'm not sure I've ever heard of anyone playing HDDVD_TS folders with Front Row. I'm not saying it won't work, but I'm not sure it's really supported either. I do have DVD Studio Pro myself, but I'll have friends or family staying with me for nearly the next month, so my evenings and weekends will be a bit full to try making one up for testing...

  • Having problems with OPA 10 and office 2007 templates

    Hi,
    I have a OPA 10 and office 2007 set up which is having some issues with the macros. Seems to me that the visual basic code is not kicking off really well sometimes. I am trying to map the sequence which leads to the errors and I believe that the issue is around opening an old word doc which has a old template version (.dot). This may be the cause for OPA getting lost when working with word 2007.
    For example, I ask to open a rules doc and the visual basic tells me that OPA couldn't open the doc but word is opening the doc anyway. However none of the toolbar commands work as well as I can 't save the doc etc.
    Have you experienced any issue with OPA 10 and Office 2007? Any special word configuration? Should i go back to office 2003?
    BTW, I have both dotm and dot templates loaded as add-ins in word. The dotm toolbar looks good but the dot toolbar is a bit strange in 2007.
    Cheers,
    Paulo

    Hi Paulo,
    Have a look at the following tips from Davin Fifield about troubleshooting the toolbar.
    Sometimes when using Oracle Policy Modeling, Microsoft Word documents that are part of a Policy Modeling project may appear without the OPA toolbar (in Office 2003) or OPA options on the Add-Ins ribbon (in Office 2007) when opened in Microsoft Word.
    This problem can be caused by various factors.
    Here are the top three troubleshooting steps to try to recover from this situation.
    1. With your project open in Oracle Policy Modeling, run Update Oracle Policy Templates from the Tools menu. This will attempt to make sure the correct Word template is attached to each project Word document that is not currently excluded from the build. Open a Word document to see if the toolbar/ribbon is now displayed correctly. If not, continue to step 2.
    2. Try changing the UI language for your project. To do this, choose Options, from the Tools menu in Oracle Policy Modeling. Select Environment. Selet General. Under Authoring UI Language, choose a language other than your preferred UI language, and click OK. Then repeat these steps to revert to your preferred language. Open a Word document to see if the toolbar/ribbon is now displayed correctly. If not, continue to step 3.
    3. Open one of the Word documents in your Policy Modeling project. Run the macro UpdateToolbar: In Word 2007, choose the View ribbon, then select Macros/View Macros, highlight the UpdateToolbar macro, then choose Run.
    Does this resolve your issue?
    Jasmine

  • Still having problems with UAG SP4 and Windows 8.1

    Hello,
    This must be one of many threads on this topic but I'm stuck.
    Because of the incompatibility with 8.1 and UAG2010 we've updated to SP4. Now, out-of-the-box 8.1 no longer wants to install the client components via ActiveX. I can log in, but the client isn't compliant so not all functions are available.
    I actually had to manually get the client components from our UAG server. After installing I compared the System Information window with that of my 8.0 / IE10 installation and the only difference is that I can't see the version of the Device Session Cleanup
    and SSL Application Tunneling gives me a "red X" in 8.0 and says "not detected" in 8.1. I did notice some .NET 3.5 components missing in 8.1 so I installed those too.
    Compatibility mode does not help and switching to IE9 mode using the developer console is a workaround, not a solution.
    What am I not seeing here?

    Hi,
    maybe the same problem we've faced:
    http://social.technet.microsoft.com/Forums/forefront/en-US/2e8d916f-d694-42de-a96f-ad2b8761775c/no-activex-uag-client-install-golden-bar-on-ie11-after-upgrading-to-uag-sp4?forum=forefrontedgeiag
    Regards,
    Chris

  • Having problems with my Broadband and BT will not ...

    Hi
    For the last TWO years I have had problems with my broadband.
    The problem is that my hub keeps re-synic it self. Yes I know that this supposed to happen but surly not up to 10 times a day, (some times 6 times in one hour) Every Day.
    I have no extension  sockets just a Phone & broadband hub connected to the master socket
    I know the problem is neither with my BT Hub or my phone as I have replaced with another of each and the problem still persists.
    I have checked my wiring, BT have checked the exchange all appears to be OK. BT sent a engineer to check my master socket and because they could not find a fault I got charged £80 and I still got the problem.
    I explained to the engineer that I think the problem is the Length of cable between the point were the line comes in and my master socket (it over 9 meters long) which goes all round my flat (maybe picking up electrical interference) , but they have refused to move my master socket to make it shorter.
    What else can I do ? It BT responsibility for the wiring between the point the line accesses my property and the master socket but they wont do any think to correct matters. All I am told they could send a engineer but it will cost if they can't find the fault.
    As I said this problem is been going on for over two years , I can not use my laptop, Internet radio without losing connection after a hour or so. I am getting very frustrated and thinking of cancelling my BT contract, and going to some where else.

    Hi thanks for reply
    The problem is not with my computer. Its only about 2 feet away from the hub
    It my Broadband hub that problem is with. The Blue broadband light on the Hub goes out, after a couple of seconds comes back on flashing orange, then after about 30 seconds it stops flashing and remains a steady orange, then returns to blue again. 
    I know the hub is supposed to this occasionally to re-synic for difference in line speed etc, but surly not every day and some times about ten times in a day. I have sat here and watch it do it even up to six times in a hour. It not a faulty hub as I have replaced that and still the problem persists
    I can hear intermittent broadband type noise on my phone but again I have replaced the filter many times (and the telephone) but the fault is still there.
    I think it must be electrical pick up.
    I have no extension socket (just the hub and phone connected to the Master socket)
    I have asked BT to come and shorten the cable between were the line Enters my Flat and Master socket, (The cable is over 9 Meters long and goes all round my flat before getting to the MASTER socket.
    But  even though cable before the master socket is BT's responsibility they refuse without me paying a call out charge of about £80 to come out to shorn it.
    So for the last Two years I have the problem but I am getting very frustrated now, so am thinking that when my contract runs out in a couple of months I will go to another suppler that will move my master socket for Free. Why Should I pay £20 pounds a month for rubbish service>

Maybe you are looking for