You need to get out of using NetBeans as a code-generation device and use it as an IDE. Then you can study the Swing tutorials and learn and understand Swing coding and solving this would be second nature to you. For one, you would separate your program logic from your GUI code so that it would be easier for logical units to interact. Next you wouldn't create several separate JFrames but instead would create GUI code that's geared towards creating JPanels and then you could place these panels anywhere you'd want to including in dialogs or swapping them by using CardLayouts.