Hello "liana liana"-
Welcome to JavaRanch.
On your way in you may have missed that we have a
policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do
right here.
As to your question, applets work a bit different than applications. For starters, what you might try is to replace these two lines:
by
Assuming that NewJFrame extends JFrame, there's no need for the "a" JFrame. You also can't add a JFrame (which is a window) to the content pane of another window.
This will open a new window, though. Is that what you want? If not, then
you should refactor the code to put whatever goes into NewJFrame (most likely some JComponents) to go in the content pane of the JApplet.