java - reassigning JList & JComboBox data -
I am looking through the Java API, but there is no luck working in it. After starting a jailist, is there a way to change, or reload, the 'data' string? I do the same with the jcff box.
string [] data = {"one", "two", "three", "four"}; Jellist Data List = New Zelist (Data); JLIS is using one of the utility constructors, which takes an array.
The list is supported by the listModel. The utility manufacturer uses the following for the implementation of AbstraSystemDollel:
New Essentials ListsDel () {public int getSize () {return listData.length; } Public object getElementAt (int i) {return catalog data [i]; }}
where list data will be
your data will be set and you can do this by
dataList.setModel () Can pass in
.
For reference, here it is.
JComboBox:
You can be the best job, if it's for more than just a prototype, by your own complete development of Listmodel. A bit simpler, because there is a manufacturer of the DefaultComboBoxModel
class that takes an array of object
as a parameter, you can just call to change the data Are:
myComboBox.setModel (new DefaultComboBoxModel (data));
Comments
Post a Comment