Problems clearing and adding items to Jlist box.
I have a set of 12 items stored in each record of a database. These record items are named as follows:

I have no problems in accessing the database.
and so on....

I need to clear an existing jlist box called LANGUAGES and place the record items listed above sequentially into the jlist box

Any assistance would be most welcome
thanks in advance...... mike

One final note: this code does not have to be in the form of a function, simply code to be pasted into the the program itself.... thanks

The trick is to get the list box's ListModel (the ListModel maintains all the data that the list displays). That will give you an instance of DefaultListModel which has methods to clear the model, add elements to it etc.

This is my code:

    String[] items = {rs.getString("LANGUAGE1"),rs.getString("LANGUAGE2"),rs.getString("LANGUAGE3"),rs.getString("LANGUAGE4"),rs.getString("LANGUAGE5"),rs.getString("LANGUAGE6"),rs.getString("LANGUAGE7"),rs.getString("LANGUAGE8"),rs.getString("LANGUAGE9"),rs.getString("LANGUAGE10"),rs.getString("LANGUAGE11"),rs.getString("LANGUAGE12")};
    DefaultListModel LIST_MODEL.getModel(JList (NEW_LANGUAGES));
    for(int i = 0;i<=11; i++) {   

The problem that I am having is in line 2. I am not getting the listmodel, therefore nothing is being changed or added to the Jlist box. Data is being stored in the array as shown in the println statement. the error suggests missing";"

Line 2 syntax is a bit garbled. This is the easy way to do it:
1. Create a DefaultListModel
2. Create the JList using that model
3. Add stuff to the model
4. Clear/add to the model as required