Help: JComboBox and Events
Hi, this is my first time here and i was just wondering if anyone could answer a question for me.
How do you use events such as ItemListener or ActionListener with JComboBoxs? Say if I have a JComboBox
JComboBox jc = new JComboBox();
Container contentPane = getContentPane();
I know how to setup a combo box but i don't know how to get it to do something. What I want to be able to do is that if the users chooses "track a" from the JComboBox , then it does something else. I've been looking for a way to get the action to choose something.
I know you use getSource() and things like that but , as you can see, I'm a bit confused about it. If anyone know any good sites for JComboBox tutorials or could help , I would be very grateful.
So my question is, How do I get an ItemListener to get the chouice from the JComboBox and then do something with that.
Thanks for your time.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL