Solved

JComboBox after JPanel.repaint

Posted on 2003-11-23
4
591 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

623 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