救命啊,是在不知道什么毛病,我这个显示面板的Applet为什么在IE下无法显示,在浏览器里面只有一个区域,而没有控件了?操作系统是Win2003server,IE6.0以上。郁闷!编译.class文件也通过了,请大侠们指点一下:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.sql.*;
public class Transfer extends JApplet
{
//定义变量
//定义面板
JPanel panObj;
//定义标签
JLabel labAccount1;
JLabel labAccount2;
JLabel labAmount;
//定义文本框
JTextField textAccount1;
JTextField textAccount2;
JTextField textAmount;
//定义按钮
JButton bOk;
JButton bCancel;
//用网格袋布局
GridBagLayout gbl;
GridBagConstraints gbc;
public void init()
{
//初始化布局
gbl=new GridBagLayout();
gbc=new GridBagConstraints();
//初始化面板
panObj=(JPanel)getContentPane();
panObj.setLayout(gbl);
//初始化标签
labAccount1=new JLabel("帐户1");
labAccount2=new JLabel("帐户2");
labAmount=new JLabel("金额");
//初始化文本框
textAccount1=new JTextField();
textAccount2=new JTextField();
textAmount=new JTextField();
//初始化按钮
bOk=new JButton("OK");
bCancel=new JButton("Cancel");
//加入第一个帐户控件
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=1;
gbc.gridy=5;
gbl.setConstraints(labAccount1,gbc);
panObj.add(labAccount1);
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=4;
gbc.gridy=5;
gbl.setConstraints(textAccount1,gbc);
panObj.add(textAccount1);
//加入第二个帐户控件
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=1;
gbc.gridy=8;
gbl.setConstraints(labAccount2,gbc);
panObj.add(labAccount2);
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=4;
gbc.gridy=8;
gbl.setConstraints(textAccount2,gbc);
panObj.add(textAccount2);
//加入帐户数额控件
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=1;
gbc.gridy=11;
gbl.setConstraints(labAmount,gbc);
panObj.add(labAmount);
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=4;
gbc.gridy=11;
gbl.setConstraints(textAmount,gbc);
panObj.add(textAmount);
//加入按钮控件
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=1;
gbc.gridy=11;
gbl.setConstraints(bOk,gbc);
panObj.add(bOk);
gbc.anchor=GridBagConstraints.NORTHWEST;
gbc.gridx=4;
gbc.gridy=11;
gbl.setConstraints(bCancel,gbc);
panObj.add(bCancel);
}
} |