Results 1 to 6 of 6

Thread: JList refresh

  1. #1
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Smile JList refresh

    Hi,

    I'm new here and a new JVA developer too.

    I have a JFrame with 3 JComboBox on it.

    I need to do a refresh on these JComboBoxes.

    The 3 JComboBoxes are initialized with default values....

    Then if a select a value on the first JComboBox, values may need to change on the second one.

    Here is the code I'm using:

    if (fonc.getSelectedIndex() == 1){
    String [] combospec = {"DB",
    "PROD",
    "TEST"};
    }


    I'm trying to change values on the string array I'm using on second JComboBox, but values never change....I still have default values....

    How can I refresh the please ?

    Best regards, Pierre.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Update the values on the ComboBoxModel.

  3. #3
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Try learning about events and listeners. You need to listen to the first combo box and respond to its selection changed events by updating the next combo box, and so on.

  4. #4
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Thanks a lot for your help !!! I will try to do this...:)

    BTW, do you have an exemple to see how to use ComboBoxModel please ?

    Regards, Pierre.

  5. #5
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Thanks a lot Steve !!

    Can I use the same listener that I'm using for the JButtons(this one works) ?
    Or do I have to create a specific one to listen JComboBox ?

    Do you have an exemple please ?

    Regards, Pierre.

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

Similar Threads

  1. JComboBox Refresh..
    By nikosa in forum AWT / Swing
    Replies: 9
    Last Post: 12-17-2009, 10:50 PM
  2. Refresh the page
    By udhayageetha in forum AWT / Swing
    Replies: 2
    Last Post: 07-01-2008, 10:03 AM
  3. Avoiding refresh
    By java_srinivasan in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-25-2008, 10:01 AM
  4. refresh JPanel
    By olesja in forum AWT / Swing
    Replies: 1
    Last Post: 04-16-2008, 04:58 PM
  5. How to Refresh the same page by JSP
    By AbuAziz in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 12-10-2007, 05:06 AM

Posting Permissions

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