我有一些我正在尝试运行的代码,但我不断收到“applet not initialized”的错误消息,我无法确定它为什么不起作用。
import javax.swing.*;
import java.util.*;
public class Assignment6 extends JApplet
{
private int APPLET_WIDTH = 500, APPLET_HEIGHT = 200;
private JTabbedPane tPane;
private CreatePanel createPanel;
private TransferPanel transferPanel;
private Vector accountList;
//The method init initializes the Applet with a Pane with two tabs
public void init()
{
//list of accounts to be used in every panel
accountList = new Vector();
//register panel uses the list of accounts
transferPanel = new TransferPanel(accountList);
createPanel = new CreatePanel(accountList, transferPanel);
//create a tabbed pane with two tabs
tPane = new JTabbedPane();
tPane.addTab("Account creation", createPanel);
tPane.addTab("Account transfer", transferPanel);
getContentPane().add(tPane);
setSize (APPLET_WIDTH, APPLET_HEIGHT); //set Applet size
}
}