How can I get the 3 individual strings from the JList? If I use model.elementAt I get the strings, but they are not separated from each other.
- How is the data stored in the JList?
- Can i perhaps get the data separated from each other by using an array?
- Is the data stored in a array?
while(resultaat.next()){
model.addElement(resultaat.getString(1) + " "
+ resultaat.getString(2) + " "
+ resultaat.getString(3));
}
I use that line of code to add a bunch of strings to a JList model. The strings are from a mysql database.
Create some kind of container object that can represent the values you want, that is capable of displaying the values in the format that you want…
Add the wrapper object to the model…
And when you need to, retrieve the values…
For example