Changing Combo box model

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Changing Combo box model

  1. #1
    Join Date
    Aug 2005

    Question Changing Combo box model

    Hello Every One,
    I need to create a combo box with the MutableComboBoxModel but didn't understand how to do it from the API sepcification on .The recquirment is that a record has to be deleted by choosing the item from the combo box and after deleting the record, the selected item should also be removed from the combo box. If you try to remove the item with method removeItemAt(int), it throws an exception that the model should be changed to MutableComboBoxModel in order to remove items from the combo box. I hope this clearifies the problem.
    Can any one help me with the topic. An early response will be highly Appreciated.

  2. #2
    Join Date
    Dec 2004
    San Bernardino County, California
    Each of the Swing components which display data use a Model to hold/access the data, the UI portion then works to display the data accessed through the Model. Models are implemented through provided Interfaces.

    One of the Model Interfaces for the JComboBox is MutuableComboBoxModel. You create a ComboBoxModel class which implements the MutableComboBoxModel interface, then when you create your JComboBox you use the constructor which uses your ComboBoxModel as its argument.

    In the "How to Use a ComboBox" portion of the JavaTutorial, you'll see reference to It uses an array of strings as its data source, then the author sets the ComboBox as editable. This did not need to have the full on implementation of a Model - is this what you're looking for, or is your data more complex than this?

Similar Threads

  1. Combo box changing textbox
    By InsuranceGuru in forum VB Classic
    Replies: 2
    Last Post: 06-23-2005, 10:58 PM
  2. Searching records using a Combo box
    By Ernie in forum VB Classic
    Replies: 2
    Last Post: 02-04-2003, 01:12 PM
  3. Query help in Access Combo Box
    By Larry Muller in forum VB Classic
    Replies: 1
    Last Post: 02-24-2001, 10:12 PM
  4. Adding horizontal scroll bar to a combo box
    By Kevin McCormack in forum VB Classic
    Replies: 4
    Last Post: 07-20-2000, 03:14 PM
  5. Adding horizontal scroll bar to a combo box
    By Kevin McCormack in forum VB Classic
    Replies: 0
    Last Post: 07-20-2000, 10:03 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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center