用JAVA编写用户登陆界面,用户验证通过数据库实现

2020-12-09 06:36:57 字数 5803 阅读 2071

1楼:匿名用户

这是我以前写的系统登录框的login

package java1;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import java.util.*;

import javax.swing.*;

import javax.swing.event.*;

import java.awt.rectangle;

import java.awt.font;

public class login extends jframe

catch (exception ex)

}public static void main(string args)

private void jbinit() throws exception

});jbutton1.setbounds(new rectangle(38, 159, 81, 29));

jbutton1.settext("确定");

jbutton1.addactionlistener(new actionlistener()

});jtextfield1.setbounds(new rectangle(109, 79, 136, 23));

jpasswordfield1.setbounds(new rectangle(109, 115, 136, 23));

this.getcontentpane().add(jlabel1);

jlabel3.setfont(new java.awt.font("隶书", font.plain, 24));

jlabel3.settext("学 生 考 试 系 统");

jlabel3.setbounds(new rectangle(22, 15, 268, 47));

this.getcontentpane().add(jtextfield1);

this.getcontentpane().add(jlabel2);

this.getcontentpane().add(jbutton2);

this.getcontentpane().add(jbutton1);

this.getcontentpane().add(jlabel3);

this.getcontentpane().add(jpasswordfield1);

jlabel2.setforeground(color.red);

jlabel2.settext("密码");

jlabel2.setbounds(new rectangle(26, 112, 68, 29));

}jlabel jlabel1 = new jlabel();

jlabel jlabel2 = new jlabel();

jtextfield jtextfield1 = new jtextfield();

jbutton jbutton1 = new jbutton();

jbutton jbutton2 = new jbutton();

jlabel jlabel3 = new jlabel();

jpasswordfield jpasswordfield1 = new jpasswordfield();

main2 wo=new main2();

int sum;

//判断权限的方法

public void success()

catch(exception c)

}//根据权限设置窗口

public void very()

else

}public void jbutton1_actionperformed(actionevent e)

//判断密码是否为空

else if (jpasswordfield1.gettext().length()==0)

else

else

}else

}catch(exception c)}}

public void jbutton2_actionperformed(actionevent e)}

用java编写的一个用户登录界面,登录验证要连接oracle数据库,(是一个租车管理系统

2楼:孤独飞雪飘

这是我以前写的系统登录框的login

package java1;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import java.util.*;

import javax.swing.*;

import javax.swing.event.*;

import java.awt.rectangle;

import java.awt.font;

public class login extends jframe

catch (exception ex)

}public static void main(string args)

private void jbinit() throws exception

});jbutton1.setbounds(new rectangle(38, 159, 81, 29));

jbutton1.settext("确定");

jbutton1.addactionlistener(new actionlistener()

});jtextfield1.setbounds(new rectangle(109, 79, 136, 23));

jpasswordfield1.setbounds(new rectangle(109, 115, 136, 23));

this.getcontentpane().add(jlabel1);

jlabel3.setfont(new java.awt.font("隶书", font.plain, 24));

jlabel3.settext("学 生 考 试 系 统");

jlabel3.setbounds(new rectangle(22, 15, 268, 47));

this.getcontentpane().add(jtextfield1);

this.getcontentpane().add(jlabel2);

this.getcontentpane().add(jbutton2);

this.getcontentpane().add(jbutton1);

this.getcontentpane().add(jlabel3);

this.getcontentpane().add(jpasswordfield1);

jlabel2.setforeground(color.red);

jlabel2.settext("密码");

jlabel2.setbounds(new rectangle(26, 112, 68, 29));

}jlabel jlabel1 = new jlabel();

jlabel jlabel2 = new jlabel();

jtextfield jtextfield1 = new jtextfield();

jbutton jbutton1 = new jbutton();

jbutton jbutton2 = new jbutton();

jlabel jlabel3 = new jlabel();

jpasswordfield jpasswordfield1 = new jpasswordfield();

main2 wo=new main2();

int sum;

//判断权限的方法

public void success()

catch(exception c)

}//根据权限设置窗口

public void very()

else

}public void jbutton1_actionperformed(actionevent e)

//判断密码是否为空

else if (jpasswordfield1.gettext().length()==0)

else

else

}else

}catch(exception c)}}

public void jbutton2_actionperformed(actionevent e)}

能帮我用java写一个登录界面并连接sql数据库进行用户名和密码验证,界面实现对数据库的查询,财富值可加

3楼:匿名用户

是java控制台呢,还是jsp页面?

4楼:bug惡魔

= =这得写几个文件,这咋回答你

5楼:匿名用户

舶回答champion1187qbcxgdemgz2603170055,,

用java做了一个简单的登陆窗口,已经连上数据库,如何用数据库验证登陆的用户名和密码? 10

6楼:周游测试类

首先定义几个字段属性。然后把数据库里面字段值获取出来。然后赋值到字段值里面,然后与文本框里面的值进行比较!注意必须使用:equals()比较、不能使用==

7楼:匿名用户

public void actionperformed(actionevent e)

catch (classnotfoundexception ce)if(stu.isselected())

else}

如何用java编写一个简单用户登陆界面?

8楼:

什么都不说了 直接给你**吧

package ***.moliying.ui;

import java.awt.borderlayout;

import java.awt.container;

import java.awt.flowlayout;

import java.awt.list;

import java.awt.event.actionevent;

import java.awt.event.actionlistener;

import java.io.bufferedwriter;

import java.io.fileoutputstream;

import java.io.outputstreamwriter;

import java.util.arraylist;

import java.util.arrays;

import javax.swing.jbutton;

import javax.swing.jframe;

import javax.swing.jlabel;

import javax.swing.jpanel;

import javax.swing.jpasswordfield;

import javax.swing.jtextfield;

public class login

private void initframe()});cancel.addactionlistener(new actionlistener()

});}

public static void main(string args)}