Hi, i am new here and i want an help in add the actionListener to the component of JCombo Box. Like there is Combo Box in Which there are components like name of color. When i click any component, for example i click Green color the background turns into Green. Thanx in advance..
OsamaJutt 0
Newbie Poster
Recommended Answers
Jump to PostCan you post the code you are having trouble with?
Jump to PostHere is the listener, all you need to do further is get the selected value of the combo (within the actionPerformed(ActionEvent e) method )and then change the colour of the background based on that value!
myCombobox.addActionListener (new ActionListener () { public void actionPerformed(ActionEvent e) { //change back …
All 5 Replies
NormR1 563
Posting Sage Team Colleague
majestic0110 187
Nearly a Posting Virtuoso
OsamaJutt 0
Newbie Poster
OsamaJutt 0
Newbie Poster
JamesCherrill 4,733
Most Valuable Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.