Solved

JComboBox after JPanel.repaint

Posted on 2003-11-23
4
580 Views
Last Modified: 2008-03-03
Hi,
I have a JPanel(parent) on which I am GridLayout. In my JPanel, I have two panels(child1,child2) added. Both these panels have a ComboBox. The actionListener causes the bigger panel to be repainted. Now, when if my child1.ComboBox has some item selected, how do I show it in the JComboBox next to the arrow. After a repaint, I am getting  a default value at the combo boxes.



0
Comment
Question by:miteshn
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
Tols earned 200 total points
ID: 9808887
Hi, You may use:

child1.setSelectedItem(obj);
0
 

Author Comment

by:miteshn
ID: 9810404
When I do that, it initializes the action listener, and goes into an infinite loop. I want my combo boxes to save their status before a repaint, and show the item last selected.

thanks
0
 

Author Comment

by:miteshn
ID: 9814548
i actually figured it out...first, remove the actionListeners, and then setSelectedItem. then add actionListeners again...
0
 
LVL 2

Expert Comment

by:Tols
ID: 9816180
Sorry for less of answer. In my country it was deep night. :-)
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
github account with ecipse 1 47
Java DateChooser? 3 36
map related example 6 48
table example 4 29
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question