真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

java編寫注冊(cè)代碼,Java代碼編寫

用Java編寫注冊(cè)登錄程序

什么都不說了 直接給你代碼吧

站在用戶的角度思考問題,與客戶深入溝通,找到東湖網(wǎng)站設(shè)計(jì)與東湖網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都做網(wǎng)站、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、主機(jī)域名雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋東湖地區(qū)。

package com.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 JFrame frame = new JFrame("登錄");

private Container c = frame.getContentPane();

private JTextField username = new JTextField();

private JPasswordField password = new JPasswordField();

private JButton ok = new JButton("確定");

private JButton cancel = new JButton("取消");

public Login() {

frame.setSize(300, 200);

frame.setBounds(450, 300, 300, 200);

c.setLayout(new BorderLayout());

initFrame();

frame.setVisible(true);

}

private void initFrame() {

// 頂部

JPanel titlePanel = new JPanel();

titlePanel.setLayout(new FlowLayout());

titlePanel.add(new JLabel("系統(tǒng)管理員登錄"));

c.add(titlePanel, "North");

// 中部表單

JPanel fieldPanel = new JPanel();

fieldPanel.setLayout(null);

JLabel a1 = new JLabel("用戶名:");

a1.setBounds(50, 20, 50, 20);

JLabel a2 = new JLabel("密 碼:");

a2.setBounds(50, 60, 50, 20);

fieldPanel.add(a1);

fieldPanel.add(a2);

username.setBounds(110, 20, 120, 20);

password.setBounds(110, 60, 120, 20);

fieldPanel.add(username);

fieldPanel.add(password);

c.add(fieldPanel, "Center");

// 底部按鈕

JPanel buttonPanel = new JPanel();

buttonPanel.setLayout(new FlowLayout());

buttonPanel.add(ok);

buttonPanel.add(cancel);

c.add(buttonPanel, "South");

ok.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

System.out.println(username.getText().toString());

}

});

cancel.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

frame.setVisible(false);

}

});

}

public static void main(String[] args) {

// new Login();

String ss = "abbabbbaabbbccba";

System.out.println(ss.split("b").length);

}

}

java編寫一個(gè)登陸和注冊(cè)信息的源代碼,最簡(jiǎn)單的就可以,不需要數(shù)據(jù)庫(kù)的那種

你這個(gè)不用數(shù)據(jù)庫(kù)真的是有點(diǎn)難搞

我寫了個(gè)用集合存儲(chǔ)的,你看看,能否幫上你

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

list.add("qq=123");//存儲(chǔ)的時(shí)候用(用戶名=密碼)的形式

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編寫用戶注冊(cè)界面?

界面建議用可視化來(lái)做,美觀且便捷。下面這個(gè)是完全用代碼寫的,僅供參考。

import javax.swing.*;

import java.awt.event.*;

import java.awt.*;

import java.sql.*;

public class Register extends JFrame {

JLabel jl1 = new JLabel("用戶名");

JTextField jt1 = new JTextField();

JLabel jl2 = new JLabel("郵箱");

JTextField jt2 = new JTextField();

JLabel jl3 = new JLabel("密碼");

JPasswordField jpw1 = new JPasswordField();

JLabel jl4 = new JLabel("密碼確認(rèn)");

JPasswordField jpw2 = new JPasswordField();

JButton register = new JButton("注冊(cè)");

JButton clean = new JButton("清空");

public Register(){

setLayout(new GridLayout(5,2));

add(jl1);

add(jt1);

add(jl2);

add(jt2);

add(jl3);

add(jpw1);

add(jl4);

add(jpw2);

add(register);

add(clean);

String name = jt1.getText();

String email = jt2.getText();

String pw = jpw1.getText();

register.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

try{

Class.forName("com.mysql.jdbc.Driver");

Connection con = DriverManager.getConnection("jdbc:mysql://localhost/db","root","");

Statement sta = con.createStatement();

sta.executeUpdate("INSERT INTO register VALUES(name,email,pw)");

JOptionPane.showMessageDialog(null,"注冊(cè)成功","提示",JOptionPane.INFORMATION_MESSAGE);

}

catch(Exception ex){

ex.getStackTrace();

}

}

});

clean.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e){

jt1.setText("");

jt2.setText("");

jpw1.setText("");

jpw2.setText("");

}

});

}

public static void main(String[] args){

Register frame = new Register();

frame.setTitle("用戶注冊(cè)");

frame.setLocationRelativeTo(null);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setSize(400,400);

frame.setVisible(true);

}

}

用java寫一個(gè)手機(jī)商城注冊(cè)界面代碼

這篇文章主要介紹了java通過JFrame做一個(gè)登錄系統(tǒng)的界面完整代碼示例,具有一定借鑒價(jià)值,需要的朋友可以參考下。

在java的JFrame內(nèi)通過創(chuàng)建匿名對(duì)象的方式做登錄界面

package com.sxt;

import java.awt.Container;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

public class LoginFrame extends JFrame{

JTextField txtname=new JTextField();

JPasswordField txtpass=new JPasswordField();

JButton bl=new JButton("登錄");

JButton bg=new JButton("關(guān)閉");

//構(gòu)造無(wú)參構(gòu)造器把主要的方法放在構(gòu)造器里,然后在main方法里面調(diào)

public LoginFrame(){

setBounds(25,25,250,250);

Container c = getContentPane();

c.setLayout(new GridLayout(4,2,10,10));

c.add(new JLabel("用戶名"));

c.add(txtname);

c.add(new JLabel("密碼"));

c.add(txtpass);

c.add(bl);

c.add(bg);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setVisible(true);

//注意:此處是匿名內(nèi)部類

bg.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

System.exit(0);

}

}

);

//注意:此處是匿名內(nèi)部類

bl.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {


分享標(biāo)題:java編寫注冊(cè)代碼,Java代碼編寫
URL地址:http://weahome.cn/article/dsehisj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部