Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet compiles but displays nothing

 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Working through a book to refresh java skills and study for SCJP. I just compiled an applet and for whatever reason it will not display in applet viewer. Any ideas?



This is what I have in the HTML file:



This is really odd as this is basically how I've gotten every applet to work up to now....and yes this is straight out he book as its an example.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, my. Look extremely carefully at this line, in which you attempt to override the paintComponent method. Although this method is just one Component of a functioning applet, it's an important Component.

public void paintCompnent(Graphics window){

Subtle, eh?
[ July 27, 2005: Message edited by: Ernest Friedman-Hill ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been having a lot of these since I'm using the command line and notepad. Is the reason I didn't get a compilation error is because I'm declaring a new method paintCompnent and the paintComponent from teh super class is whats actually being called?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matt Kidd:
I've been having a lot of these since I'm using the command line and notepad. Is the reason I didn't get a compilation error is because I'm declaring a new method paintCompnent and the paintComponent from teh super class is whats actually being called?

Yup.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of really marvelous free IDEs available, from simple ones like TextPad up through industrial-strength ones like Eclipse, NetBeans, and JDeveloper. Some of these would have indicated the mistake. Friends don't let friends program with NOTEPAD.EXE!
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
There are a number of really marvelous free IDEs available, from simple ones like TextPad up through industrial-strength ones like Eclipse, NetBeans, and JDeveloper. Some of these would have indicated the mistake. Friends don't let friends program with NOTEPAD.EXE!


hmm....i read somewhere that its better to use notepad and the command-line so that I can internalize the inner workings so to speak of Java more. I understand that on the job I won't be using notepad but I'm worried that hte IDE will be a crutch for me at this stage of my relearning java. To whit, I've already downloaded and installed NetBeans at work (Not an IT job) and Eclipse at home.

I may repost this as its starting to get off topic...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic