Java - Applet什么都不显示?

时间:2015-12-09 19:53:52

标签: java swing applet

我是创建applet的新手,我开始创建一个applet。但是,当我这样做时,我的applet中没有显示任何内容。 (即只是一个空的小程序)。有谁知道我做错了什么?任何帮助将不胜感激,谢谢!

    package Dictionary;

import javax.swing.JApplet;

import BankAccount.BankGUI;

public class DictGUIDriver extends JApplet {

private static final int APPLET_WIDTH = 650; 
private static final int APPLET_HEIGHT = 400; 

private DictGUIMain dictGUI; 

public void init()
{
    dictGUI = new DictGUIMain(); 
    getContentPane().add(dictGUI);
    setSize(APPLET_WIDTH,APPLET_HEIGHT); 
}
}

package Dictionary;

 import javax.swing.*; 

public class DictGUIMain extends JPanel 
{ 
private JTextField fileTextField; 
private JLabel fileLabel;
private JPanel panel; 
//have a constructor for the frame 

public DictGUIMain()
{
    //create the dictionary object here Dictionary dict = new Dictionary(); 
    panel = new JPanel(); 
    fileLabel = new JLabel("Choose File: ");
    final int FIELD_WIDTH = 20; 
    fileTextField = new JTextField(FIELD_WIDTH);

    panel.add(fileLabel);
    panel.add(fileTextField);

    //create the button stuff here 

}

}

0 个答案:

没有答案