Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Paint not being called

 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a custom component that I'm trying to draw on the screen. However, my paint()/painComponent() method is not being called. My component inherits from JPanel and overrides paintComponent(Graphics g) (although it has also overridden paint(Graphics g) at various points in its history as I've tried to make this thing work.)
I place this JPanel in another JPanel and that in a JFrame and show the JFrame and .... nothing
below is my current draft code, along with a lot of stuff commented out that I've tried and it hasn't worked. Any suggestions?



[ March 16, 2004: Message edited by: Joel McNary ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's the code for the component that overrides paint() and paintComponent()?

If you override paint() and don't call super.paint() inside it, then paintComponent() will never get called.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic