我有一些我试图运行的代码,但是我一直收到一条错误,说“applet未初始化”,我无法确定为什么它不起作用。
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
}
}