Solved

JComboBox after JPanel.repaint

Posted on 2003-11-23
4
584 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle SQL syntax check  without executing 6 75
MySQL  on Tomcat 8 69
hashmap order 17 37
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 22
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

828 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