When you click a tab on a JTabbedPane, components are not displayed immediately

I have an application that includes a JTabbedPane and two tabs with some components. My problem is that when I click on another tab, the components do not appear immediately; but when the mouse cursor moves over each component ( JCheckBox , JButton , etc.) of the tab, the components will appear, but not correctly (see the image below).

alt text http://hivaonline.persiangig.com/1.gif

alt text http://hivaonline.persiangig.com/2.gif


This is my CODE.,.

+4
source share
4 answers

Thank you for your reply message, the problem was calling the repaint () component called when its position changed, the marker location should be changed every time the map is moved by a user or a page event, so I think calling repaint () caused a loop and another component draw correctly.

0
source

Do you mix some awt and swing?

This can lead to such unpredictable consequences.

+2
source

Can you see the exception on the console? Exceptions to the Dispatching Thread event can cause this behavior.

+1
source

As others have observed, your code is incomplete. As a guide, review this article on the benefits of Short, Self Contained, Correctable (Compilable), Example . Several such examples are discussed in How to Use Dashboards . You can compare them with what you are doing.

+1
source

Source: https://habr.com/ru/post/1310478/


All Articles