OK. I figured out one solution. Instead of extending JPanel or JFrame,
I extened JDialog and everything is working as expected.
I would still like to know what I asked below. Basically, I want to
write a "Main Menu" that loads other functions of the program.