When clicking a tab on a JTabbedPane the components don't appear immediately
I have an applic开发者_运维问答ation that includes a JTabbedPane
and two tabs with some components. My problem is when I click on another tab, it's components do not appear immediately; but when the mouse courser moves over each component (JCheckBox
, JButton
and so on) of the tab, the components will appear but not correctly (see below image).
alt text http://hivaonline.persiangig.com/1.gif
alt text http://hivaonline.persiangig.com/2.gif
This is my CODE . . .
Are you mixing some awt and swing stuff?
This could probably make such unpredictable effects.
Can you see an exception on the console? Exceptions in Event Dispatching Thread can cause such behavior.
As others have observed, your code is incomplete. As a guide, consider this article on the benefits of a Short, Self Contained, Correct (Compilable), Example. Several such examples are discussed in How to Use Tabbed Panes. You might compare them with what you're doing.
thanks a milion for your response, the problem was calling repaint() of a component that called when i changing it position, the location of marker must be change every time the map move by user or page event occurred, so i think calling repaint() caused a loop and other component not paint correctly.
精彩评论