• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing object to JList

 
Rob Brew
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's your question ?
 
Rob Brew
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that the word JList in your post has been turned into a link. Following that link should get you started.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!