sirvan
sirvan

Reputation: 331

When clicking a tab on a JTabbedPane the components don't appear immediately

I have an application 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 . . .

Upvotes: 4

Views: 455

Answers (4)

sirvan
sirvan

Reputation: 331

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.

Upvotes: 0

trashgod
trashgod

Reputation: 205775

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.

Upvotes: 1

Konrad Garus
Konrad Garus

Reputation: 54005

Can you see an exception on the console? Exceptions in Event Dispatching Thread can cause such behavior.

Upvotes: 1

daniel
daniel

Reputation: 3174

Are you mixing some awt and swing stuff?

This could probably make such unpredictable effects.

Upvotes: 2

Related Questions