• Post Reply Bookmark Topic Watch Topic
  • New Topic

text not displaying well

 
darren malt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ya guys.
Ive noticed that the text in my JButtons doesn't always display properly, but if I resize the screen, repaint or press the button or whatever,it corrects itself. Is there a way I can fix this random problem?
thanks in advance for any tips you can give me.
Daz...
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you dynamically setting the button text?

If so, you need to call validate() or invalidate() on your button's container to have it re-layout the button and render it at the correct size.
 
darren malt
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to have done the trick Nate.
Thanks for your help.
Daz.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!