import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import javax.swing.event.*;
import java.sql.*;
import java.util.Vector;
//import javax.applet.Applet;
public class AppletTest extends Applet implements ActionListener{
JLabel JLuseName = new JLabel("用户名:");
JLabel JLpassword = new JLabel("密码:");
JLabel JLNotarizePassword = new JLabel("确认密码:");
JTextField JTLandingName = new JTextField();
JPasswordField JTPassword = new JPasswordField();
JPasswordField JTNotarizePassword = new JPasswordField();
JButton JBrefer = new JButton("提交");
JButton JBreset = new JButton("重设");

public void init(){
//this.setTitle("注册界面");
this.setLayout(null);
this.setBounds(10,10,500,400);
JLuseName.setBounds(30,30,100,20);
this.add(JLuseName);
JLpassword.setBounds(43,70,100,20);
this.add(JLpassword);
JTLandingName.setBounds(80,30,120,20);
this.add(JTLandingName);
JTPassword.setBounds(80,70,120,20);
this.add(JTPassword);
JLNotarizePassword.setBounds(17,110,100,20);
this.add(JLNotarizePassword);
JTNotarizePassword.setBounds(80,110,120,20);
this.add(JTNotarizePassword);
JBrefer.setBounds(50,160,60,20);
this.add(JBrefer);
JBrefer.addActionListener(this);
JBreset.setBounds(150,160,60,20);
this.add(JBreset);
JBreset.addActionListener(this);
}

public void actionPerformed(ActionEvent e){
if(e.getSource() == JBrefer){
String userName = JTLandingName.getText();
String userPassword = JTPassword.getText();
String notarizePassword = JTNotarizePassword.getText();
String sql = "select * from landingpassword where LandingName='"+userName+"'";
if(!userPassword.equals(notarizePassword)){
JOptionPane.showMessageDialog(null,"输入密码有误");
}else{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//添加JDBC-ODBC桥驱动类
    Connection cot = DriverManager.getConnection("jdbc:odbc:yuan","","");//连接数据库
    Statement stat =cot.createStatement();//创建Statement对象
    ResultSet rs = stat.executeQuery(sql);//获得查询结果
    if(rs.next())
     JOptionPane.showMessageDialog(null,"该号已经存在!");
    else{
     sql = "insert into landingpassword values('"+userName+"','"+userPassword+"')";
     int i = stat.executeUpdate(sql);
     if(i>0){
     JOptionPane.showMessageDialog(null, "添加成功");
     //this.dispose();
     }
     else
     JOptionPane.showMessageDialog(null,"添加失败");
    }
}catch(Exception em){
em.printStackTrace();
}
}
}
if(e.getSource() == JBreset){
JTLandingName.setText(null);
JTPassword.setText(null);
JTNotarizePassword.setText(null);

}
}
}上面的程序如果改用java编写的窗口可以访问到数据库,但一用Applet就不可以了,各位大侠帮帮忙