Results 1 to 3 of 3
Thread: Listbox Add/Delete
- 04-08-2008, 02:17 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 8
- Rep Power
- 0
Listbox Add/Delete
I have read countless tutorials on how to do this yet I am still stuck
I think the problem is that most tutorials are manually drawing their Lists
I have a JFrame with a JList dragged onto it (I am using Netbeans)
I want to press one button to add to the list box and one to delete (delete the item selected)
I have tried using getSelectedIndex etc
But it doesn't delete anything and a lot of errors occur in the Output console
I have seen a lot of mention of something like DefaultListModel or something named similar
Where can I be going wrong, there isn't even a remove option like most tutorials say. Let me repeat for clarities sake I am a newb I only started using this program 2 weeks ago but I know that I don't want to draw a New list box in another form
Thanks
- 04-12-2008, 10:33 AM #2
Member
- Join Date
- Nov 2007
- Posts
- 35
- Rep Power
- 0
I have the same problem too, I read that I should use Array of items then use add(array) to add to the list. I tried it but it's not working also I read about DefaultListModel and tried it and stills the item is not added to the list.
what is the difference between the two ways of adding to the JList?
:confused:
- 04-16-2008, 04:49 PM #3
first, obviously you set the values into the list... and it exactly shows the consequences depends on how had you arrange them accordingly.... right?
for example, i have
deftones, El Nino, Underground, hardcore
Well, you can put it in the list....
What if i like to delete El Nino?
Then, delete El Nino,
Replace all the values from the list and put this again,
deftones, Underground, hardcore
correct me if im wrong,
sukatoa
Similar Threads
-
delete string in JtextArea
By cloudet in forum AWT / SwingReplies: 3Last Post: 05-05-2008, 10:06 AM -
Store retrieve and delete
By on7june in forum New To JavaReplies: 1Last Post: 03-08-2008, 05:57 PM -
problem when I try to delete a file
By tommy in forum Advanced JavaReplies: 2Last Post: 07-31-2007, 02:44 PM -
Doubt in edit and delete methods
By ai_2007 in forum Advanced JavaReplies: 3Last Post: 07-01-2007, 11:40 AM -
How to delete a file
By Alpha in forum New To JavaReplies: 1Last Post: 05-26-2007, 08:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks