isuhendro
asked on
How to reset JList?
how to clear all items inside a JList?
I have tried using
trackList.removeAll(()
but does no effect.
I also tried using code below:
Object[] blank = {""};
trackList.setListData(blan k);
.. it will clear up, but change this list as if setVisibleRowCount = 1.
Thanks & regards
I have tried using
trackList.removeAll(()
but does no effect.
I also tried using code below:
Object[] blank = {""};
trackList.setListData(blan
.. it will clear up, but change this list as if setVisibleRowCount = 1.
Thanks & regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hello Mark,
thanks for your reply. I prefer not to using model for this JList, otherwise will need to change codes at other part.
btw repaint() will not help as well..
thanks for your reply. I prefer not to using model for this JList, otherwise will need to change codes at other part.
btw repaint() will not help as well..
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok then Mark... just found out that the problem with setVisibleCountRow become 1, is related to the BorderLayout... not to the list itself.. so i will use previous solution. Btw what is the advantage of using DefaultListModel ?
Thanks & regards.
Thanks & regards.
Better design, more functionality for free.
Take a look at the model-view-controller design pattern. You have one model with maybe multiple views and multiple controllers. This way the model/view/controller are separated from each other which makes extending it easy etc.
Many advantages by using established design patterns.. anyway, it's not necessary. :-)
Mark
Take a look at the model-view-controller design pattern. You have one model with maybe multiple views and multiple controllers. This way the model/view/controller are separated from each other which makes extending it easy etc.
Many advantages by using established design patterns.. anyway, it's not necessary. :-)
Mark
Mark