• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

Applet compiles but displays nothing

 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24208
47
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
N
 
Matt Kidd
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24208
47
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic