how do i add a listmodel to vector?

how do i add a listmodel to vector so that i can retrieve it later for displaying?the contents of the listmodel depend on what is added to it from another list.
[174 byte] By [j123456789a] at [2007-11-26 18:09:50]
# 1

this is the first list:

String[] data = {"Access97", "Basic Programming",

"C++ Programming", "COBOL Programming",

"DB Design", "Fortran programming"};

IndustrySkillsList = new JList(data);

i add the selected skill to another list:

DefaultListModel listModel = new DefaultListModel();

JList ApplicantSkillsList = new JList(listModel);

using the add button:

public class Add2Listener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

String temp1;

temp1 = (String)IndustrySkillsList.getSelectedValue();

listModel.addElement(temp1);

}

}

is it possible to store the 2nd list, after the stuff has been added from the first list, in a vector? so that in future i can retrieve this 2nd list and display it? if so, could anybody explain or tell me how to?

j123456789a at 2007-7-9 5:41:54 > top of Java-index,Desktop,Core GUI APIs...
# 2
ListModel has methods getSize() and getElementAt().Should be a no-brainer to make a loop out of those and copy the elements into a Vector...
itchyscratchya at 2007-7-9 5:41:54 > top of Java-index,Desktop,Core GUI APIs...
# 3

well you could just add the whole list to the Vector, i.e. add the whole Jlist to the Vector. then just pull it off later and add it back into the frame.

but the best way would be to use (String)Jlsit.getModel.getElementAt(index), to cycle through all the elements and get them off, you can then just add them into a Vecror.

look at the Jlist and Vector APIs its pretty simple.

grilleda at 2007-7-9 5:41:54 > top of Java-index,Desktop,Core GUI APIs...
# 4
thanks to both of you (:
j123456789a at 2007-7-9 5:41:54 > top of Java-index,Desktop,Core GUI APIs...