Results 1 to 2 of 2
  1. #1
    Vith is offline Member
    Join Date
    Dec 2010
    Rep Power

    Default Jcombobox ArrayList


    i hava a gui with a combobox.
    I have a Arraylist <myClass>

    How do i make my defaultComboBoxModel , so i can manipulate the arraylist , and the same time , my combobox is uptodate with the edited arraylist?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I'm no pro at this, but one way is to write your own Combo Box Model. Just like the DefaultComboBoxModel, it should inherit from AbstractListModel and should implement all the interfaces that the Default model does. Then your ArrayList could serve as the data nucleus of the model. If you don't want to go through all this trouble, you could instead modify your ArrayList in parallel to changes made to a DefaultComboBoxModel by adding a ListDataListener to your model.

Similar Threads

  1. Replies: 7
    Last Post: 11-22-2010, 01:26 PM
  2. Replies: 2
    Last Post: 11-16-2010, 05:51 PM
  3. Creating an ArrayList from an ArrayList
    By Klahking in forum New To Java
    Replies: 17
    Last Post: 09-09-2010, 03:34 PM
  4. Replies: 2
    Last Post: 12-10-2009, 01:58 PM
  5. Replies: 2
    Last Post: 04-21-2008, 11:43 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