Results 21 to 33 of 33
Thread: How to disabled a node.
- 06-26-2008, 12:50 PM #21
- 06-26-2008, 12:54 PM #22
in my code say i have the information about child1, so that whenever user click on child1 leaf that information will be populated.
But i dont have the information of child2, it is in progress but i have to show that it is there in parent.
that's why in this case i want to disable child2.
But for the time bieng i used a pop message saying "Information is not available", its just a shorcut for skip.
but i really want to disable instead of any message..Thanks & Regards
- 06-26-2008, 01:02 PM #23
Yes he wants to disable it so that he cant workout on it.
Check this link, it has something similar like what is required
How to disable a certain treenode in a jtree (Swing / AWT / SWT / JFace forum at JavaRanch)
It gives some code to disable a particular child node.
I dont know why the thread initiator is not checking it.To finish sooner, take your own time....
- 06-27-2008, 04:11 AM #24
- 06-27-2008, 06:13 AM #25
Yes, the link you provided give some code about disabling a particular child node, but as i told earlier that i am not able to use that logic in my code..
Plz help to use that logic in my code that i have provided.Thanks & Regards
- 06-27-2008, 06:18 AM #26
- 06-30-2008, 07:51 AM #27
Now you got it..
Plz suggest.Thanks & Regards
- 06-30-2008, 09:13 AM #28
- 06-30-2008, 11:39 AM #29
ya i checked it and i also replied many times that i am not able to use that logic in my code.that's why i need help of yours.
there "this.setEnabled(false)" is used to disable that particular code.
I just wonder that "this" refer to the object of that child node or something else???Thanks & Regards
- 06-30-2008, 05:17 PM #30
Sorry, I can't help you solve your problem by suggesting a way.
But perhaps I can explain what's wrong with your code as originally given.
You are getting the compiler error because setEnabled() is NOT a method in the class DefaultMutableTreeNode.
It is an inherited method in DefaultTreeCellRenderer class as used in the Niveditha link.
- 06-30-2008, 05:54 PM #31
In the code of that link "this" refers to DefaultTreeCellRenderer as the class extends MyCellRenderer.
Why dont you try to write the same simple class and implement it in ur code.
Instead of checking what's going wrong try to use the code which is correctly working. I didnt mean u should stop with your code u can always correct it by trying out different ways not when u need it for your project.To finish sooner, take your own time....
- 06-30-2008, 05:56 PM #32
I meant to say "this" refers to DefaultTreeCellRenderer as the class MyCellRenderer extends DefaultTreeCellRendererTo finish sooner, take your own time....
- 07-01-2008, 07:30 AM #33
- By hemanthjava in forum AWT / SwingReplies: 3Last Post: 01-16-2013, 07:23 AM
- By Preethi in forum AWT / SwingReplies: 4Last Post: 06-19-2008, 11:25 PM
- By Avdhut in forum AWT / SwingReplies: 2Last Post: 06-03-2008, 09:07 PM
- By Kabiraa in forum AWT / SwingReplies: 7Last Post: 05-09-2008, 07:54 AM
- By swimberl in forum NetworkingReplies: 2Last Post: 01-04-2008, 08:48 PM