Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Solution for JComboBox ?  RSS feed

 
anchit pancholi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Right now i am using swing combobox and action listener to get selected item. But Now i like modeify the working of current combox by adding button in drop down so if user click twise on button then item will be added twise in cart. i searched but didn't get specific answere according to my requirement, Can anyone suggest some replacement of combobox in which i can add button in drop down ? (or can i add button in drop down, which can act as a button not as item of combobox so that i can use listener on button)

Thank
Anchit
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't add an ActionListener to the JComboBox for adding to a cart. I would provide a JSpinner alongside to set the quantity and a JButton for 'Add to cart'

If the JComboBox initially displays a prompt (like ' --- Select --- ' then I would initially disable the spinner and button and enable them only when a valid selection is made (using an ActionListener added to the combo).
 
anchit pancholi
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:I wouldn't add an ActionListener to the JComboBox for adding to a cart. I would provide a JSpinner alongside to set the quantity and a JButton for 'Add to cart'

If the JComboBox initially displays a prompt (like ' --- Select --- ' then I would initially disable the spinner and button and enable them only when a valid selection is made (using an ActionListener added to the combo).


Hi Darryl,

Thanks for Suggestion, but i am looking forward use button kind of think in drop down. Do you know similar kind of thing can possible in SWT,Jgoodies or SwingX?

Thanks
Anchit
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anchit pancholi wrote:Do you know similar kind of thing can possible in SWT,Jgoodies or SwingX?

No, I don't use any of those. someone else might be able to help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!