Saturday, November 15, 2008

Get all elements from JList

I’ve onced do not know how to get data from JList and save it into mysql table.
Then i look into Sun API,and then i found this code..It create a loop of the elements of the JList…

[code]

ListModel model=JList.getModel();
for (int i=0;i < model.getSize();i++)
{
/**
* System.out.println(model.getElementAt(i));
*/
String a=(String) model.getElementAt(i);
}

[/code]

Hope it was usefull to all of us..Although maybe a lot of people already know this.. :-)

No comments: