密码的文本框实现失去焦点时实现密码校对检验 怎么实现??
import com.dbmanage.*;
import java.awt.*;
import java.awt.Font.*;
import java.awt.event.*;
import java.util.Date;
import javax.swing.*;
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.awt.event.FocusListener ;
public class HIMSDBA extends JPanel implements ActionListener ,FocusListener{
public int IDint2;
public String GLY_Name;
public String Sex1;
public String JG;
public String DZ;
public String phone;
public String MM;
public String E_Mail;
public String nowTime1;
Label lable10=new Label("管理员注册界面");
Label lable1=new Label("管理员名称");
Label lable11=new Label("性别");
Choice sex=new Choice();
Label lable2=new Label("籍贯");
Label lable3=new Label("地址");
Label lable4=new Label("联系方式");
Label lable5=new Label("新密码");
Label lable6=new Label("确认密码");
Label lable7=new Label("E_Mail");
JButton Button1=new JButton("注册");
JButton Button2=new JButton("取消");
TextField text1=new TextField (5);
TextField text2=new TextField (10);
TextField text3=new TextField (20);
TextField text4=new TextField (15);
TextField text5=new TextField (10);
TextField text6=new TextField (10);
TextField text7=new TextField (15);
public HIMSDBA (){
text6.setEchoChar('*');
Box baseBox ,baseBox0 ,boxV0,boxV1,boxV2,boxV3,boxV5,boxV4;
boxV0=Box.createVerticalBox();
boxV0.add(lable10);
lable10.setFont(new java.awt.Font("SansSerif",1,20));
lable10.setForeground(Color.red);
boxV1=Box.createVerticalBox();
boxV1.add(lable1);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable11);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable2);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable3);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable4);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable5);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable6);
boxV1.add(Box.createVerticalStrut(38));
boxV1.add(lable7);
//boxV1.add(Box.createVerticalStrut(138));
// boxV1.add(button1);
boxV2=Box.createVerticalBox();
boxV2.add(text1);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(sex);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text2);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text3);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text4);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text5);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text6);
boxV2.add(Box.createVerticalStrut(38));
boxV2.add(text7);
boxV5=Box.createHorizontalBox();
boxV5.add(Button1);
boxV5.add(Box.createHorizontalStrut(60));
boxV5.add(Button2);
baseBox=Box.createHorizontalBox();
baseBox.add(boxV1);
baseBox.add(Box.createHorizontalStrut(2));
baseBox.add(boxV2);
baseBox0=Box.createVerticalBox();
baseBox0.add(boxV0);
baseBox0.add(Box.createVerticalStrut(38));
baseBox0.add( baseBox);
baseBox0.add(Box.createVerticalStrut(38));
baseBox0.add( boxV5);
setLayout(new FlowLayout());
add(baseBox0);
sex.add("男");
sex.add("女");
text5.addFocusListener(this);
Button1.addActionListener(this);
Button2.addActionListener(this);
}
public void focusLost(FocusEvent e)
{ if(e.getSource()==text6){
if(!text5.getText().trim().equals(text6.getText().trim()))
{
JOptionPane.showMessageDialog(null, " 密码错误!","系统信息", JOptionPane.PLAIN_MESSAGE);
}
}
}
这是其中一段代码,我想密码的文本框实现失去焦点时实现密码校对检验
不过怎么出现Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet.
初学还没用过这个方法。各位大侠帮帮忙!!