Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Panic about an Applet for a simple diner menu

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having some major runtime issues with this code and have been experiencing huge headaches over this code and this forum has been popping up repeatedly when I have been trying to fix it. The problems I am experiencing are finally limited to runtime errors, but it seems to be generated by my loops. The errors I am getting are as follows:

java.lang.NullPointerException
at MyMenu.init(MyMenu.java:65)
at sun.applet.AppletPanel.run(AppletPanel.java434)
at java.lang.Thread.run(Thread.java:722)

As you can see, below the error is related to an initialization loop I have.

at this time I have spent nearly 2.5 weeks trying to fix this program, I am just desperate to hear that it something simple and I will not have to start all over again =(

 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have all of these

each one needs a corresponding
= new Component();

e.g.
title = new JLabel();

go through your code and make sure they're there, if not add them
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating an array doesn't populate it; each array element has its default value -- 0 for numeric primitives, false for boolean and null for reference types.
 
The harder you work, the luckier you get. This tiny ad brings luck - just not good luck or bad luck.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic