Solved

JComboBox after JPanel.repaint

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now