Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 03:17 AM
Member
 
Join Date: Dec 2007
Posts: 8
Rageagainst20 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-12-2008, 11:33 AM
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 05:49 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 508
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete string in JtextArea cloudet AWT / Swing 3 05-05-2008 11:06 AM
Store retrieve and delete on7june New To Java 1 03-08-2008 06:57 PM
problem when I try to delete a file tommy Advanced Java 2 07-31-2007 03:44 PM
Doubt in edit and delete methods ai_2007 Advanced Java 3 07-01-2007 12:40 PM
How to delete a file Alpha New To Java 1 05-26-2007 09:11 AM


All times are GMT +3. The time now is 01:27 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org