As others have said, you need to create the JPanel before you try to add it to the JFrame. In fact, you should typically create all components inside the JPanel as well. I suggest that you move the calls to
Text();
Buttons();
Fields();
from the Executer
constructor to the MyPanel()
method and call MyPanel()
before calling frame.add(panel);
.
In addition, you do not need to call frame.setVisible(true);
twice. Also, you should use a LayoutManager
rather than calling panel.setLayout(null);
. See the Oracle tutorial for Using Layout Managers.