The time now is 08/29/08 - 01:22
Log in: Username: Password:
Search forums for:
  

Help with Java

Post new topic   Reply to topic
Author Message
Owyyn
RealPoor Guru
RealPoor Guru


Joined: 11 Oct 2002
Posts: 2900



PostPosted: 12/03/05 - 23:19    Post subject: Help with Java Reply with quote

I'm making a Keno game for my final project. I'm having a problem that I can't seem to get rid of.

I have 3 classes involved with the problem: Panels, OddsPanel and NumbersPanel. Panels is the parent Class of OddsPanel and NumbersPanel.

Clicking on a button in NumbersPanel should make a call to the updateOdds() method in OddsPanel. I get this error though:

Code:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
   at NumbersPanel.actionPerformed(NumbersPanel.java:95)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


If anyone feels like helping me I can send the code.... there's too much to be able to post it all here.
Back to top
Owyyn
RealPoor Guru
RealPoor Guru


Joined: 11 Oct 2002
Posts: 2900



PostPosted: 12/04/05 - 00:54    Post subject: Reply with quote

Here's some simplified code that represents the same problem:

Code:
public class Test
{
   protected Test2 test2;
   protected Test3 test3;

   public static void main(String[] args)
   {
      Test2 test2 = new Test2();
      Test3 test3 = new Test3();
   }
}


Code:
public class Test2 extends Test
{
   public Test2()
   {}
   
   public String print()
   {
      return "Weeee";
   }
}


Code:
public class Test3 extends Test
{
   public Test3()
   {
      System.out.println( test2.print() );
   }
}


Compiles fine but gives runTime errors. =\
Back to top
motherface
RealPoor Guru
RealPoor Guru


Joined: 12 Mar 2003
Posts: 3407



PostPosted: 12/04/05 - 01:58    Post subject: Reply with quote

http://www.rafb.net/paste/
Back to top
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1

Related topics: