• 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Code has runtime error, when trying to create a frame. I have a deadline in 2 hours please help.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Error:


Exception in thread "main" java.lang.NullPointerException
at D.WriteYourName.initialize1(WriteYourName.java:121)
at D.WriteYourName.<init>(WriteYourName.java:37)
at D.Swing.main(Swing.java:33)


There is also another class, that is inherited, but the error is caused by "WriteYourName" class.
 
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are line 121,37 and 33?
 
Rancher
Posts: 3063
23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a deadline in 2 hours


That is irrelevant. People answer questions when they have time.

You need to manage your time more effectively

at D.Swing.main(Swing.java:33)


The code you posted is not the code you are executing because line 33 is a blank line, so we can't tell exactly what the problem is.


One of the fundamental rules of Swing is that components should be created and modified on the Event Dispatch Thread (EDT). So the creation of your  WriteYourName object should be done in the invokeLater() code.

And why do you have 2 setVisible() statements?
 
Ranch Hand
Posts: 188
5
MS IE Notepad Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well - aside from the stacktrace doesn't match up with the posted code ...

1) what the hell is "extends Swing" ?
2) carefull reading line by line - posted code lacks init of button-groups - wich in posted code is 135 - try to use group1.add() but never used group1=new ButtonGroup()
3) you had 2 hour deadline at time of post - now it's 4 days gone - what's your result - what happend as deadline passed?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!