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 3 of 3

Thread: Dynamic JComboBoxes ?

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic JComboBoxes ?

    Hi people i need you to help me with a problem.

    It regards dynamic combo boxes( i think they are called dynamic because i googled it and thats how most people describe it), now I do have ComboBoxes covered in my book, but it doesn't cover what I need now. For my project I need to build 2 combo boxes. And I can select a value from the first combo box and that value will then directly effect the second combo box which will then contain values which are dependent on the value chosen in the first combo box. Now I can implement regular combo boxes in my program and make them work, but I just can not find a good and clear example of how the communication between them works, so if anyone could be kind enough to help me out here, I would appreciate it very much.


  2. #2
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,233
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: Dynamic JComboBoxes ?

    It depends upon your datamodel, but you can monitor the selected choice of the first with an ActionListener, upon which you remove all items of the second and then populate it with the appropriate information.

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Dynamic JComboBoxes ?

    Okay I understand that but, i am a beginner in Java especially GUI, so if you could provide a example that a beginner could understand I would be thankful. And my knowledge of ActionListeners is now really vague, I think this is a too big of a bite for me now, but I would really like if I could get a hang of this. Thank you for the reply, i will try googleing some more.

Similar Threads

  1. Dynamic UI
    By ganeshkumar.salvi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 8th, 2011, 03:54 AM
  2. Dynamic Web Project + Tomcat 7.0
    By atul.mathur31 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 18th, 2011, 06:01 PM
  3. JTable JComboBoxes
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 8th, 2010, 01:46 PM
  4. JComboBoxes & Events
    By KevinGreen in forum AWT / Java Swing
    Replies: 3
    Last Post: April 21st, 2010, 05:11 AM
  5. Replies: 2
    Last Post: July 8th, 2009, 06:35 AM