Results 1 to 2 of 2
  1. #1
    anthropamorphic's Avatar
    anthropamorphic is offline Senior Member
    Join Date
    Jun 2011
    Posts
    135
    Rep Power
    0

    Default Refresh A JList With A Model

    Hello, I am having a bit of a problem. I have created a JList and set it up with a model, and what I need it to do is whenever I hit a specific button it reloads itself. basically I have a class that gets all the subdirectories in a directory and stores it in an array. When I hit this button it creates a new folder so, I need it to then update the JList.

    I have tried a few things, but this is the only one I can remember
    Java Code:
    model.removeAllElements();
    				new MultiList();
                	for(int i = 0; i < l.list.length; i++){
    
            			model.addElement(l.list[i]);
            		}

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

    Default Re: Refresh A JList With A Model

    Your code seems reasonable, but I have no idea what new MultiList() does, I hope you don't create a new JList because that defeats the purpose of updating the model.

    Post your Short, Self Contained, Correct Example that demonstrates the problem.

Similar Threads

  1. Refresh A JList
    By anthropamorphic in forum New To Java
    Replies: 7
    Last Post: 09-11-2011, 05:59 PM
  2. Replies: 1
    Last Post: 08-11-2011, 07:56 PM
  3. Refresh jList
    By karq in forum New To Java
    Replies: 1
    Last Post: 07-16-2010, 02:58 AM
  4. JList refresh
    By pbaudru in forum AWT / Swing
    Replies: 5
    Last Post: 01-20-2010, 10:24 AM
  5. Replies: 1
    Last Post: 01-08-2010, 06:19 AM

Tags for this Thread

Posting Permissions

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