j_baxter99
asked on
Adding text to jlist
how do i add text to a jlist and make it visible?
an example please
an example please
ASKER
Yep i can do that but i want to add to how do i add contents to it dynamically.
e.g
String [] str = {"aa","bb"};
JList list = new JList(str);
and now i want to add "cc" to my list
how do i do it?
cheers
e.g
String [] str = {"aa","bb"};
JList list = new JList(str);
and now i want to add "cc" to my list
how do i do it?
cheers
ASKER
also how do i update it when it is added, i.e refresh the list.
ASKER
ok i have it but how do i get it to scroll
Dear j_baxter99,
JList list = new JList(str);
list.addItem("How are you?");
It will get automatically scrolled when the list is growing.
Bye
Murali
JList list = new JList(str);
list.addItem("How are you?");
It will get automatically scrolled when the list is growing.
Bye
Murali
ASKER
thats is only for a awt.List it doesnt work that way for JList`s muralirm
hi,
inorder to get scrollbar add the Jlist to JScrollPane u will get the scroll bar.
mb...
inorder to get scrollbar add the Jlist to JScrollPane u will get the scroll bar.
mb...
ASKER
cant get the scroll pane to become visible ???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jscrollpane.getViewport(). add(list, null).
try this
String [] str = {"aa","bb"};
JList list = new JList(str);
mb...