Is that the best program design? Would another layout out of the components be better? Like JTabbedPane.

If you must have two frames, have you tired using the setVisible() method?