• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AWT-EventQueue-0" - need Help

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Swing and I wonder if somebody can explain to me what is wrong with the program I am making:

Here's the code:



Here's the error:


Please explain to me what's wrong.. ANybody? Thank you..
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your firstGui.SimpleGui_2 code looks ok to me,
though I haven't actually tried running it.

The error complains about the actionPerformed()
method in the firstGui.SimpleLayout class, which
you haven't shown us.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you managed to pass null to anything? This two-year old thread resurfaced yesterday; I wrote about how I look for NullPointerExceptions, which are a frequent problem, so you need to know about them.
 
Beth Laguardia
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brian: Yeah, sorry. The first program that I posted is a working program.

Here's the not working program.. sorry for the inconvenience..



Please somebody explain what's wrong? Thank you all..

[ August 28, 2008: Message edited by: Beth Laguardia ]
[ August 28, 2008: Message edited by: Beth Laguardia ]
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

SimpleLayout.actionPerformed(SimpleLayout.java:40)


The error message says an object reference (pointer) at source line 40 in SimpleLayout is null. Look at that line of code and see what pointer could be null. I bet its button1.

In the go method you've "hidden" the definition of button1 with a local one and have NOT initialized the global one referenced where the NPE occurs.
[ August 28, 2008: Message edited by: Norm Radder ]
 
Beth Laguardia
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your right!

I change this

to ths:

Thank you!
 
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic