For some reason, my paintComponent (Graphics g) method is called endlessly. It seems I can’t say who is calling it, even if I give StackTrace in a call (this is an event that was sent and processed).
Are there any simple ways to find out who triggers the event?
Update: I found the reason, and now I understand the reason. Anyone who answers correctly will receive an answer to the question.
Here is the code causing the problem:
@Override public void paintComponent(Graphics g) { myJButton.setIcon(ResourceLoader.getImageIconWithLocale(MY_BUTTON_IMAGE)); super.paintComponent(g); }
FYI: This is really hard! This is not obvious when you look at the code. I made the assumption that it was wrong.
SetIcon (ImageIcon) , ImageIcon .
ResourceBundle, , , , . .
ResourceLoader ( ) ImageIcon. , , . , , setIcon ( , JButtons), , newIcon!= OldIcon.
HashMap ResourceLoader, , (, , ). , .
, , - . , , . , , .
- , , /.
repaint() ? , ( ) , "" paintComponent() , .
repaint()
paintComponent()
, paintComponent(). .
Swing , . , Icon , , , .
Source: https://habr.com/ru/post/1760791/More articles:.NET: Custom format for web service documentation? - .netДиалоговое окно jQuery больше не работает после добавления в- jqueryФорматирование UITableView Cells в iphone - iosHow to execute all views in a database using a stored procedure - sql-serverПолучить список месяцев из списка - listintegration with cappuccino django - djangoCan PHP handle drag and drop interactivity? - phpChoosing a license for PHP software - phpОдна библиотека PHP для авторизации многих социальных сетей? - phpЭквивалент assertRegexMatches в python 2.4 - pythonAll Articles