Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom JComponent - setSize make visible  RSS feed

 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an object which extended JComponent.
In the paintComponent, I have a drawString,
which just output a string.

I noticed that if I don't have setSize, the string
would not be displayed. In addition, the string
need to fit the size also, else it's not displayed as well.

The string s a variable. As such, I can't pre-defined
a size. Any good way to make my custom component
viewable?

Please advise.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!