File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Multiple listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Multiple listeners" Watch "Multiple listeners" New topic
Author

Multiple listeners

Anindita De
Greenhorn

Joined: Nov 05, 2009
Posts: 3
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!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18140
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple listeners
 
Similar Threads
Question from NickyEng
AJAX Status Code of 8
Extreme Planner and "drilldown"
Shopping cart JSP, ActionForm example
Shopping cart application using struts