Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Multiple listeners

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an e-commerce application interface, where I have checkboxes for each item, a "Add selected to Cart" button and in addition, an "Add to Cart" button for each item.

I would have to implement a number of listeners in order to add items to the cart. Can anyone give me ideas about how to get started with this?

Also, everytime I need to add an item to the cart, I want to make a separate JPanel for that item within an outer JPanel. Therefore, I am to add this sub JPanel for display everytime the user chooses to add an item.

Any help would be appreciated!

Thanks!
 
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To implement a number of listeners, you would simply implement them one at a time. So, is your question how to use listeners, or is it something else?

Also, the idea of adding new components to a panel all the time is a difficult one to implement. In my opinion it would be better to have a single component (like for example a JTable) and to modify that component each time the user chooses another item.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic