I have GUI app that involves multiple frames.
First of all you should not be using multiple JFrames. Generally speaking an application should only have a single JFrame. Child windows should be JDialogs.
This code gives me the error "non-static method dispose() cannot be referenced from a static context MainWindow.dispose();"
You can use the ActionEvent object to access the frame you want to close:
You can also check out
Closing an Application for a simple API to handle closing of the frame.