JFrame will not close giving null pointer exception

Hello ev1, Heres what I'm doing, I have a menu with JButtons that when pressed will take you to a game (this works fine). When your done with the game, you press a button that closes the JFrame(game) and starts the menu again (this gives the error null pointer exception). Heres a brief summary of the design:

FullScreenSetup class

has openWindow() that sets up a new full screen JFrame. (works)

has closeWindow() that removes everything in the contentPane and sets

visible(false).

GameMenu class

uses FullScreenSetup via FullScreenSetup window;

uses window.openWindow() to set up the window.

also sets up the buttons and handles them when pressed

VideoPoker class (the game)

uses FullScreenSetup via FullScreenSetup window;

runs the game and has the button that should close the window and go

back to the menu.

heres how i thought it should work, in the actionPerformed method I have

window.closeWindow(); <- this gives me the error

new GameMenu(); <- this is my ultimate goal (hopefully brings me

back to the menu screen to choose another game)

I hope what I have written is enough for someone to help me because I know what it is like to read through hundreds of lines of code to help someone. Thx.

[1325 byte] By [Dr_Spuda] at [2007-11-26 21:21:49]
# 1
What I cannot understand is that when going from the menu to the game I use window.closeWindow();so that I can clear the menu and paste the game on the screen this works fine. so why does it not work a second time?
Dr_Spuda at 2007-7-10 3:01:19 > top of Java-index,Desktop,Core GUI APIs...