This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Passing object to JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Passing object to JList" Watch "Passing object to JList" New topic
Author

Passing object to JList

Rob Brew
Ranch Hand

Joined: Jun 23, 2011
Posts: 99
Hi everyone.

I want to display objects in a JList then remove an item when a button is clicked the item "bought" is bought, and the item is then removed from the list. I then want to pass the object as a variable to a method in a different class, which will remove it from an arraylist.

So far here's the relevant code:





Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3419
    
  12
What's your question ?


Joanne
Rob Brew
Ranch Hand

Joined: Jun 23, 2011
Posts: 99
How do i pass a list of object "bought" to the JList and have it's title getName displayed.

How do i remove the item from the JList

Can I then pass the item to the method itemBought() which will the remove it from an ArrayList?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3419
    
  12
Notice that the word JList in your post has been turned into a link. Following that link should get you started.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Passing object to JList
 
Similar Threads
MZs Notes - Pg 159
JPA criteriaBuilder method not found
update a JList based on an Array
problems when using a datable within a form: currently my code is clunky
Error can't find class