• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel constantly repainting itself  RSS feed

 
Kristo Liiva
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JFrame I have two JPanels and a JLabel. In one panel there are JComboBoxes with ActionListeners which ask the Label to repaint itself when an action is fired, in the other panel there are JCheckBoxes with ActionListeners which also ask the label to repaint itself. The problem is that the label is rapidly repainting itself, even if nothing is selected.
Can anyone tell what the problem might be?

Also, the code is here:
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the call to setBorder which leads to another repaint, which leads to another call to setBorder, which leads to another repaint, etc...
Put this call in the MessageLabel constructor instead.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!