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

    Default Jcombobox ArrayList

    hi!

    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
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

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

Posting Permissions

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