java程序帮我看看错误在哪里

来源:百度知道 编辑:UC知道 时间:2024/06/13 20:07:05
// <applet code=Customertwo codebase="../bin" width=200 height=100>
//</applet>
import javax.swing.*;
public class Customertwo extends JApplet{
JPanel panelObject;
JLabel labelCustNo;
JLabel labelCustName;
JLabel labelCustSex;
JLabel labelCustAge;
JLabel logoimagePosition;
JTextField textCustNo;
JTextField textCustName;
JComboBox comboCustSex;
JTextField textCustAge;
public void init(){
panelObject = new JPanel();
getContentPane().add(panelObject);
labelCustNo = new JLabel("顾客编号:");
labelCustName = new JLabel("顾客名称:");
labelCustSex = new JLabel("顾客性别:");
labelCustAge = new JLabel("顾客年龄:");
textCustNo = new JTextField(13);
textCustName = new JTextField(15);
textCustAge = new JTextField(2);
String Sex[]= {"男","女"};
comboCustSex = new JComboBox(Sex);

把html的代码改为
<applet code=Customertwo.class width=200 height=100>
</applet>

Icon logoImage = new ImageIcon("c:\\Pring.gif");
这句是错的,Applet没有权限读取本地的图片,你可以把图片放在和程序同一个文件夹下,然后用new ImageIcon("Pring.gif")