189 8069 5689

java网页登录注册代码 java用户注册登录界面代码

求JAVA实现用户登录界面代码?

你要先学会截图哦,你发的看不清楚,重新写了一个你参考参考!

成都创新互联为您提适合企业的网站设计 让您的网站在搜索引擎具有高度排名,让您的网站具备超强的网络竞争力!结合企业自身,进行网站设计及把握,最后结合企业文化和具体宗旨等,才能创作出一份性化解决方案。从网站策划到成都网站设计、成都网站建设, 我们的网页设计师为您提供的解决方案。

import java.awt.GridLayout;

import javax.swing.ButtonGroup;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JRadioButton;

import javax.swing.JTextField;

public class Day30A extends JFrame {

private static final long serialVersionUID = 1L;

private JLabel labelName,labelId,labelPass,labelMoney,labelSelect,labelCar;

private JComboBoxString jcb;

private JPanel jp1,jp2,jp3,jp4,jp5,jp6,jp7;

private ButtonGroup btg;

private JRadioButton jr1,jr2;

Day30A(){

this.setTitle("注册账户");

this.setLayout(new GridLayout(7,1));

this.setSize(300,280);

this.setLocationRelativeTo(null);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

init();

this.setVisible(true);

}

private void init() {

String str="卡片类型1,卡片类型2,卡片类型3,卡片类型4,卡片类型5";

jcb=new JComboBox(str.split(","));

labelId=new JLabel("账号: ");

labelName=new JLabel("姓名: ");

labelPass=new JLabel("密码: ");

labelMoney=new JLabel("开户金额:");

labelSelect=new JLabel("存款类型:");

labelCar=new JLabel("卡片类型:");

addFun1();

addFun2();

}

private void addFun2() {

this.add(jp1);

this.add(jp2);

this.add(jp3);

this.add(jp4);

this.add(jp5);

this.add(jp6);

this.add(jp7);

}

private void addFun1() {

jp1=new JPanel();

jp1.add(labelId);

jp1.add(new JTextField(15));

jp2=new JPanel();

jp2.add(labelName);

jp2.add(new JTextField(15));

jp3=new JPanel();

jp3.add(labelPass);

jp3.add(new JTextField(15));

jp4=new JPanel();

jp4.add(labelMoney);

jp4.add(new JTextField(13));

jp5=new JPanel();

jp5.add(labelSelect);

btg=new ButtonGroup();

jr1=new JRadioButton("定期");

jr2=new JRadioButton("活期",true);

btg.add(jr1);

btg.add(jr2);

jp5.add(jr1);

jp5.add(jr2);

jp6=new JPanel();

jp6.add(labelCar);

jp6.add(jcb);

jp7=new JPanel();

jp7.add(new JButton("确定"));

jp7.add(new JButton("取消"));

}

public static void main(String[] args) {

new Day30A();

}

}

登陆界面的java代码怎么写?

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

import java.sql.*;

class LoginFrm extends JFrame implements ActionListener

{

JLabel lbl1=new JLabel("用户名");

JLabel lbl2=new JLabel("密码");

JTextField txt=new JTextField(15);

JPasswordField pf=new JPasswordField();

JButton btn1=new JButton("确定");

JButton btn2=new JButton("取消");

public LoginFrm()

{

this.setTitle("登陆");

JPanel jp=(JPanel)this.getContentPane();

jp.setLayout(new GridLayout(3,2,10,10));

jp.add(lbl1);jp.add(txt);

jp.add(lbl2);jp.add(pf);

jp.add(btn1);jp.add(btn2);

btn1.addActionListener(this);

btn2.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==btn1)

{

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:MyDB","","");

Statement cmd=con.createStatement();

ResultSet rs=cmd.executeQuery("select * from loginAndpassword where login='"+txt.getText()+"' and password='"+pf.getText()+"'");

if(rs.next())

{

JOptionPane.showMessageDialog(null,"登陆成功!");

}

else

JOptionPane.showMessageDialog(null,"用户名或密码错误!");

} catch(Exception ex){}

if(ae.getSource()==btn2)

{

txt.setText("");

pf.setText("");

}

}

}

public static void main(String arg[])

{

JFrame.setDefaultLookAndFeelDecorated(true);

LoginFrm frm=new LoginFrm();

frm.setSize(400,200);

frm.setVisible(true);

}

}

用JAVA编写一个用户或注册登录界面。请哪位高手能够写下具体的代码,谢谢

效果图

代码

!DOCTYPE html

html

head

meta charset="UTF-8"

title先锋图书馆管理系统-登录/title

style

*{

margin: 0;

padding: 0;

list-style: none;

}

#top{

width: 1000px;

height: 95px;

margin: 0 auto;

margin-top: 25px;

}

#top_top{

width: 1000px;

height: 65px;

background: deepskyblue;

}

#top_top_left{

width: 300px;

height: 65px;

float: left;

}

#top_top_leftlabel{

width: 200px;

height: 65px;

color: white;

float: right;

}

#top_top_left#a2{

padding-left: 10px;

padding-top: 20px;

font-size: 16px;

}

#top_bottom{

width: 1000px;

height: 30px;

}

#top_bottom_left{

width: 340px;

height: 30px;

line-height: 30px;

font-size: 12px;

background: skyblue;

color: white;

text-indent: 2em;

float: left;

}

#top_bottom_right{

width: 660px;

height: 30px;

line-height: 30px;

font-size: 12px;

color: blueviolet;

text-align: center;

float: right;

background: lightskyblue;

}

#content{

width: 1000px;

height: 600px;

margin: 0 auto;

background:#587FBA;

}

#content#text{

width: 1000px;

height: 50px;

line-height: 50px;

padding-top: 100px;

font-size: 36px;

font-family:"楷体";

font-weight: bold;

text-align: center;

}

#content#login{

width: 480px;

height: 210px;

margin-top: 20px;

margin-left: 260px;

background: #85A0CB;

}

#content#loginimg{

float: left;

}

#content#login#select{

width: 305px;

height: 210px;

float: right;

}

#content#login#selectdiv{

width: 230;

height: 30px;

margin-left: 30px;

}

#content#login#select#d1{

margin-top:30px;

margin-bottom: 3px;

}

#content#login#selectp{

font-size: 14px;

margin-left: 95px;

}

#bottom{

width: 1000px;

height: 35px;

line-height: 35px;

margin: 0 auto;

background: deepskyblue;

text-align: center;

color: white;

}

/style

/head

body

div id="top"

div id="top_top"

div id="top_top_left"

img src="img/test/a13.png" width="78px" height="65px"label id="a2"先锋图书馆系统管理平台/label

/div

/div

div id="top_bottom"

div id="top_bottom_left"当前位置 : 首页  系统管理  登录/div

div id="top_bottom_right"当前时间 : label id="lable"/label/div

/div

/div

div id="content"

div id="text"欢迎登录先锋图书馆管理系统/div

div id="login"

img src="img/test/a14.png"  width="175px" height="210px"/

form id="select"

div id="d1"用户名: nbsp;nbsp;input type="text" //div

div密    nbsp; 码: nbsp;nbsp;input type="password" //div

p

input type="radio" name="user" value="read"/读者nbsp;nbsp;nbsp;nbsp;

input type="radio" name="user" value="admin"/管理员

/pbr/

p

input type="button" value="确定" style="width: 50px;" onclick="put()"/nbsp;nbsp;nbsp;nbsp;

input type="reset" value="重置" style="width: 50px;"/

/p

/form

/div

/div

div id="bottom"欣欣科技有限公司版权所有/div

/body

script type="text/javascript" src="JQuery/jquery.js"/script

script type="text/javascript" src="js/GetCurrentTime.js"/script

script

//验证用户名和密码

function put(){

var d = $("#selectdivinput");//获取用户名和密码

var name = d[0].value;

var pass = d[1].value;

var user = null;

var r = document.getElementsByName("user");//获取用户类型

for(i=0;ir.length;i++){

if(r[i].checked){

user=r[i].value;

}

}

//console.log(name + "," +pass + "," +user);//输出测试

if(user==null){

window.alert("请选择用户类型!");

}else if(user=="admin"  name!="admin"){

window.alter("用户名错误!");

}else if(user=="admin"  name=="admin"  pass!="123456"){

window.alert("密码错误!");

}else if(name=="admin"  pass=="123456"  user=="admin"){

window.location.href="work_02_welcome.html";//在js中在本页面中打开新链接

}else{

window.alert("用户名错误");

}

}

/script

/html

java编写一个登陆和注册信息的源代码,最简单的就可以,不需要数据库的那种

你这个不用数据库真的是有点难搞

我写了个用集合存储的,你看看,能否帮上你

java.util.ListString list = new ArrayListString();

list.add("qq=123");//存储的时候用(用户名=密码)的形式

list.add("ww=456");

String username = "qq";

String password = "123";

for (int i = 0; i  list.size(); i++) {

String num = username +"="+password;

if(num.equals(list.get(i))){

System.out.println("登录成功");

break;

}

}


网页名称:java网页登录注册代码 java用户注册登录界面代码
本文路径:http://cdxtjz.cn/article/dojdjpp.html

其他资讯