• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

having some minor problems

 
Martin vanPutten
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I havn't done an applet in a while. Can somebody point out why I'm not viewing anything within the applet? Also, I want to double buffer it but I had to comment out the getContentPane(). It says that it could not read it. Any reason for that as well?

 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you probably meant to extend JApplet.

Also notice the capitilization of Painter.
 
Vishal Mungi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you extend applet you add components directly :

add(new painter());

If you extend JApplet you add components to the content pane:

getContentPane.add(new painter());

when extending a JPanel you override the paintComponent method & not paint
(http://leepoint.net/notes-java/GUI-lowlevel/graphics/40drawingpanel/10drawingpanel.html)

Also, dont forget to call super.paintComponent first.
[ December 07, 2006: Message edited by: Vishal Mungi ]
 
Martin vanPutten
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getContentPane compiles now... and Painter class is capitalized but it still doesn't give me a black background. I feel like i'm missing something. Any suggestions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic