Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Dynamically changing icons of some nodes in a JTree

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Dynamically changing icons of some nodes in a JTree

    Hi,

    I am looking to change the icons in a Jtree nodes depending on some condition. For Example I am populating n number of Jobs in the Jtree under a single parent by reading a folder for xml files.
    and some of the jobs might be currently running and i wish to show the icons for these running jobs with a green dot to differentiate them from other jobs. As follows

    Jobs
    #job1
    #job2
    #job3

    [OR]

    Jobs
    #job1
    #job2
    #job3

    I just need to differentiate it from other jobs be it the icon changing or the text color changing.
    Any suggestions?

    Regards
    --vishnu--


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: Dynamically changing icons of some nodes in a JTree

    I guess you didn't like the answers I already gave you?

    This thread has been cross posted here:

    http://www.java-forums.org/awt-swing/64155-dynamically-changing-icons-some-nodes-jtree.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Dynamically changing icons of some nodes in a JTree

    Kevin,
    I appreciate your help very much.

    Its' just that I did not know that these two forums are the same. I thought they were different. If not i would never have cross posted this. I was just looking for a quick solution and hence thought i might get different people on different forums .

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: Dynamically changing icons of some nodes in a JTree

    They aren't the same. But a lot of people happen to look at both. Please read the "problems with cross posting" link for information on why people don't like crossposting.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Oct 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Dynamically changing icons of some nodes in a JTree

    Sorry! Will try not to do this again

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: Dynamically changing icons of some nodes in a JTree

    It's not really a big deal as long as you let people know you're doing it. A little blurb saying "by the way, I also posted this here..." goes a long way. That way it's easy for people to see what kind of help you've already received, otherwise we might be wasting our time repeating advice you've already heard.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Using Icons in JOptionPane
    By Jchang504 in forum AWT / Java Swing
    Replies: 3
    Last Post: September 19th, 2014, 03:28 PM
  2. Replies: 5
    Last Post: January 9th, 2012, 02:36 PM
  3. Icons not visable?
    By frozen java in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 12th, 2011, 02:44 AM
  4. JTree Selection Order Icons
    By pradeeprkm in forum AWT / Java Swing
    Replies: 1
    Last Post: August 1st, 2011, 08:58 AM
  5. JTree - Remove All Nodes
    By aussiemcgr in forum Java Theory & Questions
    Replies: 4
    Last Post: December 9th, 2010, 05:27 PM

Tags for this Thread