String name2,cellphone2; name 1 =mH+name.getText().trim()+mM; name2=name. getText() .trim(); cellphone 1=m \十川 ; ccllphonc2=ccllphonc.gctTcxt().trim(); phoneI=,,n,+phone.getText().trim()+Mfn; emafll=IR,,+email.getText().trim()+IHM; birthl=,,,H+birth.gctTcxt().trini()+mM; company l=HH,+conipany.getText().tiiin()+nu,; if(name2.equaIs(H'r)) H{ JOptionPane.showMessageDialog(nuUH姓名必须填写”); return ; } if(cellphone2.equals(\{ JOptionPane.showMessageDiabg(null,,手机号码没有填写完整 J; return; } try { String list(name,cellphone.phone,emaiLcompany,birth,groupid) Wtues(”+namel+T+cellphonel+T+phonel+T+emaill+T+companyl+T+birthl+T+'T'+\ ■ stmt.cxccutcUpdatc(strUpd); strUpd=MI NSERT INTO \\A/\\A/\\AA { } c ate 11( Except ion el) System.out.printIn(el.toString()); J Opt ionPanc. show McssagcDia log( nul L u新建记录成功\; name.setText(r,H);ccllphone.setText('m);phone.setText(,,u);email.setText(,m);company.setText(im); birth.setText(m,); temp.hide(); name.setEditable(true); lst.removeAll(); lst.addActionListener(this); if(e. get Ac tionCommand()=,r 开始査询”)
Ist.removeAIK);
String namel=search.getText().lrim(); // temp.setVisible(true);
35
int rec=0;
rs=stmt.executeQuery(HSELECT * FROM list\while(rs.next()) {
String s l=is.getString(Mid,f).trim(); String s2_rs.getString(°nameH).trim(); String s3=re.gctString(,'ccllphoncM); String s4=rs.getString(,lphone,r); Siring s5=rs.getString(Memair*); String s6-R.gctString(HcompanyH); String s7=rs.getString(Hbirthu); //namel=rs? getString(Mname,f).trim(); !f(namel.equals(s2)=triie) {
str=sl+H
H
+s2+,t ”+s3;
lst.add(str); name.setText(s2);
cellphone.setText(s3); phonc.sctTcxt(s4); cmai1.sctTcxt(s5); company.setText(s6);
birth.setText(s7.substring(0,10)); temp.show(); set();
}
// if(name I. equals(” 阚未然 M)==true)
//
catc 11(Exception el) {
£add(new Label(el.toString())); fadd(nevv Button(f,1f)); System.out.print(cl .toStringO);
if(c. get Ac t ionCommand( )=n 査询记录\
{ lst.removeAll();
String namcl; // temp.setVisible(true); try
{
int rec=0;
rs=stmt.executeQuery(HSELECT * FROM list'*); String str; while(rs.next())
{
36
//name l=rs.gctString(,'name0).trim(); s tr=rs. getS tr ing( Hid M). lrim( )+H
M
. get S tiing( Mname°). trim( )+H
+rs.gctString(,,ccllphoncn);
lst.add(str);
// if(namcl .equals(” 阚耒然 H)==truc)
//
catch(Exceptk)n el)
{
f add(new Label(el .toString())); fadd(ncw Bntton(,,,<)); System.out.print(cl.toString());
if(e.getSourceO==lst)
{
tcmp.showO;
} }
public void w indowClosing( Window Event e) {
release(); System.exit(O);
public void windowOpcncd( Window Event c) public void w indo w Ic onified( Window Event e) { }
public void windowDeiconified( Window Event e) { }
public void w indowClosed( Window Event e) { }
public void windowAclivated( Window Event e) { }
public void w indowDeactivated( Window Event e) { }
37