“so how can make the whole thing in one window”
See How to Use CardLayout. It will let you swap between views/panels, so you can stick to just one frame. Also see a simple example here
solved How to change the frame of the same window in java GUI? [closed]