Page 2 of 2 FirstFirst 12
Results 21 to 33 of 33
  1. #21
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    Hi Niveditha,

    Thanks for your concern.
    I checked that link but i am unable to use that code in my code.

    In that code "this.setEnabled(false)" is used to disable the leaf, but i dont understand how to use that logic in my Code.

    Plz suggest..
    Thanks & Regards
    Subroto Bhattacharjee:)

  2. #22
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    Hi Eranga,

    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
    Subroto Bhattacharjee:)

  3. #23
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    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....
    Nivedithaaaa

  4. #24
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #25
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    Hi Nivedhita,

    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
    Subroto Bhattacharjee:)

  6. #26
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    For me the logic I can see is get the name of child/parent selected. What is the case in your code to do that?

  7. #27
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    Yes Eranga,
    Now you got it..
    Plz suggest.
    Thanks & Regards
    Subroto Bhattacharjee:)

  8. #28
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  9. #29
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    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
    Subroto Bhattacharjee:)

  10. #30
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    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.

  11. #31
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    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....
    Nivedithaaaa

  12. #32
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Oh sorry!!!
    I meant to say "this" refers to DefaultTreeCellRenderer as the class MyCellRenderer extends DefaultTreeCellRenderer
    To finish sooner, take your own time....
    Nivedithaaaa

  13. #33
    Join Date
    May 2008
    Location
    India,Kolkatta
    Posts
    50
    Rep Power
    0

    Default

    hi Nivedhita,

    I already use that code in my project. but here i am interested in finding out the another way to disable that. thanks for your suggestion.
    Thanks & Regards
    Subroto Bhattacharjee:)

Page 2 of 2 FirstFirst 12

Similar Threads

  1. JTree Programmatic Node Expansion and Selection Probelm
    By hemanthjava in forum AWT / Swing
    Replies: 3
    Last Post: 01-16-2013, 07:23 AM
  2. Node selection in jtree
    By Preethi in forum AWT / Swing
    Replies: 4
    Last Post: 06-19-2008, 11:25 PM
  3. Replies: 2
    Last Post: 06-03-2008, 09:07 PM
  4. Replies: 7
    Last Post: 05-09-2008, 07:54 AM
  5. How to Transmit data from one node to another
    By swimberl in forum Networking
    Replies: 2
    Last Post: 01-04-2008, 08:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •