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

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

java用戶登入界面代碼 java登錄界面代碼簡單

求JAVA實現(xiàn)用戶登錄界面代碼?

你要先學(xué)會截圖哦,你發(fā)的看不清楚,重新寫了一個你參考參考!

創(chuàng)新互聯(lián)業(yè)務(wù)包括:成品網(wǎng)站、企業(yè)產(chǎn)品展示型網(wǎng)站建設(shè)、高端網(wǎng)站設(shè)計、電子商務(wù)型網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)(多語言)、電子商務(wù)商城網(wǎng)站建設(shè)、按需網(wǎng)站策劃、營銷型網(wǎng)站等。效率優(yōu)先,品質(zhì)保證,用心服務(wù)是我們的核心價值觀,我們將繼續(xù)以良好的信譽為基礎(chǔ),秉承穩(wěn)固與發(fā)展、求實與創(chuàng)新的精神,為客戶提供更全面、更優(yōu)質(zhì)的互聯(lián)網(wǎng)服務(wù)!

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 javax.swing.JFrame;//框架

import javax.swing.JPanel;//面板

import javax.swing.JButton;//按鈕

import javax.swing.JLabel;//標簽

import javax.swing.JTextField;//文本框

import java.awt.Font;//字體

import java.awt.Color;//顏色

import javax.swing.JPasswordField;//密碼框

import java.awt.event.ActionListener;//事件監(jiān)聽

import java.awt.event.ActionEvent;//事件處理

import javax.swing.JOptionPane;//消息窗口public class UserLogIn extends JFrame{

public JPanel pnluser;

public JLabel lbluserLogIn;

public JLabel lbluserName;

public JLabel lbluserPWD;

public JTextField txtName;

public JPasswordField pwdPwd;

public JButton btnSub;

public JButton btnReset;

public UserLogIn(){

pnluser = new JPanel();

lbluserLogIn = new JLabel();

lbluserName = new JLabel();

lbluserPWD = new JLabel();

txtName = new JTextField();

pwdPwd = new JPasswordField();

btnSub = new JButton();

btnReset = new JButton();

userInit();

}

public void userInit(){

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//設(shè)置關(guān)閉框架的同時結(jié)束程序

this.setSize(300,200);//設(shè)置框架大小為長300,寬200

this.setResizable(false);//設(shè)置框架不可以改變大小

this.setTitle("用戶登錄");//設(shè)置框架標題

this.pnluser.setLayout(null);//設(shè)置面板布局管理

this.pnluser.setBackground(Color.cyan);//設(shè)置面板背景顏色

this.lbluserLogIn.setText("用戶登錄");//設(shè)置標簽標題

this.lbluserLogIn.setFont(new Font("宋體",Font.BOLD | Font.ITALIC,14));//設(shè)置標簽字體

this.lbluserLogIn.setForeground(Color.RED);//設(shè)置標簽字體顏色

this.lbluserName.setText("用戶名:");

this.lbluserPWD.setText("密 碼:");

this.btnSub.setText("登錄");

this.btnReset.setText("重置");

this.lbluserLogIn.setBounds(120,15,60,20);//設(shè)置標簽x坐標120,y坐標15,長60,寬20

this.lbluserName.setBounds(50,55,60,20);

this.lbluserPWD.setBounds(50,85,60,25);

this.txtName.setBounds(110,55,120,20);

this.pwdPwd.setBounds(110,85,120,20);

this.btnSub.setBounds(85,120,60,20);

this.btnSub.addActionListener(new ActionListener()//匿名類實現(xiàn)ActionListener接口

{

public void actionPerformed(ActionEvent e){

btnsub_ActionEvent(e);

}

}

);

this.btnReset.setBounds(155,120,60,20);

this.btnReset.addActionListener(new ActionListener()//匿名類實現(xiàn)ActionListener接口

{

public void actionPerformed(ActionEvent e){

btnreset_ActionEvent(e);

}

}

);

this.pnluser.add(lbluserLogIn);//加載標簽到面板

this.pnluser.add(lbluserName);

this.pnluser.add(lbluserPWD);

this.pnluser.add(txtName);

this.pnluser.add(pwdPwd);

this.pnluser.add(btnSub);

this.pnluser.add(btnReset);

this.add(pnluser);//加載面板到框架

this.setVisible(true);//設(shè)置框架可顯

}

public void btnsub_ActionEvent(ActionEvent e){

String name = txtName.getText();

String pwd = String.valueOf(pwdPwd.getPassword());

if(name.equals("")){

JOptionPane.showMessageDialog(null,"賬號不能為空","錯誤",JOptionPane.ERROR_MESSAGE);

return;

}else if (pwd.equals("")){

JOptionPane.showMessageDialog(null,"密碼不能為空","錯誤",JOptionPane.ERROR_MESSAGE);

return;

}else if(true){

this.dispose();

}else{

JOptionPane.showMessageDialog(null,"賬號或密碼錯誤","錯誤",JOptionPane.ERROR_MESSAGE);

return;

}

}

public void btnreset_ActionEvent(ActionEvent e){

txtName.setText("");

pwdPwd.setText("");

}

public static void main(String[] args){

new UserLogIn();

}

}

登陸界面的java代碼怎么寫?

import java.awt.*; \x0d\x0aimport javax.swing.*; \x0d\x0aimport java.awt.event.*; \x0d\x0aimport java.sql.*; \x0d\x0a\x0d\x0aclass LoginFrm extends JFrame implements ActionListener \x0d\x0a{ \x0d\x0aJLabel lbl1=new JLabel("用戶名"); \x0d\x0aJLabel lbl2=new JLabel("密碼"); \x0d\x0aJTextField txt=new JTextField(15); \x0d\x0aJPasswordField pf=new JPasswordField(); \x0d\x0aJButton btn1=new JButton("確定"); \x0d\x0aJButton btn2=new JButton("取消"); \x0d\x0a\x0d\x0apublic LoginFrm() \x0d\x0a{ \x0d\x0athis.setTitle("登陸"); \x0d\x0aJPanel jp=(JPanel)this.getContentPane(); \x0d\x0ajp.setLayout(new GridLayout(3,2,10,10)); \x0d\x0ajp.add(lbl1);jp.add(txt); \x0d\x0ajp.add(lbl2);jp.add(pf); \x0d\x0ajp.add(btn1);jp.add(btn2); \x0d\x0abtn1.addActionListener(this); \x0d\x0abtn2.addActionListener(this); \x0d\x0a} \x0d\x0a\x0d\x0apublic void actionPerformed(ActionEvent ae) \x0d\x0a{ \x0d\x0aif(ae.getSource()==btn1) \x0d\x0a{ \x0d\x0atry \x0d\x0a{ \x0d\x0aClass.forName("sun.jdbc.odbc.JdbcOdbcDriver"); \x0d\x0aConnection con=DriverManager.getConnection("jdbc:odbc:MyDB","",""); \x0d\x0aStatement cmd=con.createStatement(); \x0d\x0aResultSet rs=cmd.executeQuery("select * from loginAndpassword where login='"+txt.getText()+"' and password='"+pf.getText()+"'"); \x0d\x0aif(rs.next()) \x0d\x0a{ \x0d\x0aJOptionPane.showMessageDialog(null,"登陸成功!"); \x0d\x0a} \x0d\x0aelse \x0d\x0aJOptionPane.showMessageDialog(null,"用戶名或密碼錯誤!"); \x0d\x0a} catch(Exception ex){} \x0d\x0a\x0d\x0aif(ae.getSource()==btn2) \x0d\x0a{ \x0d\x0atxt.setText(""); \x0d\x0apf.setText(""); \x0d\x0a} \x0d\x0a} \x0d\x0a} \x0d\x0a\x0d\x0apublic static void main(String arg[]) \x0d\x0a{ \x0d\x0aJFrame.setDefaultLookAndFeelDecorated(true); \x0d\x0aLoginFrm frm=new LoginFrm(); \x0d\x0afrm.setSize(400,200); \x0d\x0afrm.setVisible(true); \x0d\x0a} \x0d\x0a}

用JAVA編一個用戶登錄界面,用戶必須輸入賬號密碼才能進入

簡單代碼如下,原本想用彈窗的,懶得寫了:

import?java.awt.Container;

import?java.awt.FlowLayout;

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.JTextField;

public?class?dengru?extends?JFrame?implements?ActionListener?{

private?static?final?long?serialVersionUID?=?1L;

private?Container?c?=?null;

private?JButton?jb?=?null;

public?dengru()?{

this.setLayout(new?FlowLayout());

jb?=?new?JButton("登入");

jb.addActionListener(this);

this.add(jb);

this.setSize(500,?400);

this.setVisible(true);

this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

}

public?static?void?main(String[]?args)?{

new??dengru();

}

@Override

public?void?actionPerformed(ActionEvent?e)?{

if?(e.getSource()?==?jb)?{

JFrame?jf=new?JFrame();

c?=?jf.getContentPane();

c.setLayout(new?GridLayout(3,2,2,2));

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

JLabel?jl2?=?new?JLabel("密????碼:");

JTextField?jtf1?=?new?JTextField();

JTextField?jtf2?=?new?JTextField();

jtf1.setSize(200,?40);

jtf2.setSize(200,?40);

c.add(jl1);

c.add(jtf1);

c.add(jl2);

c.add(jtf2);

c.add(new?JButton("登入"));

jf.setVisible(true);

jf.setSize(300,?100);

jf.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

}

}

}

用java寫一個登錄界面的代碼,哪位大神會啊,謝謝。

import?java.awt.Dimension;

import?java.awt.Toolkit;

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.JOptionPane;

import?javax.swing.JPasswordField;

import?javax.swing.JTextField;

public?class?Test26?{

public?static?void?main(String[]?args)?{

final?String?userName?=?"abc";

final?String?passwrod?=?"123";

JFrame?jFrame?=?new?JFrame("登陸界面");

Dimension?dimension?=?Toolkit.getDefaultToolkit().getScreenSize();

jFrame.setBounds(((int)dimension.getWidth()?-?200)?/?2,?((int)dimension.getHeight()?-?300)?/?2,?200,?150);

jFrame.setResizable(false);

jFrame.setLayout(null);

jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

JLabel?label1?=?new?JLabel("姓名");

label1.setBounds(10,?10,?100,?30);

jFrame.add(label1);

JLabel?label2?=?new?JLabel("密碼");

label2.setBounds(10,?40,?100,?30);

jFrame.add(label2);

final?JTextField?text1?=?new?JTextField();

text1.setBounds(50,?15,?130,?20);

jFrame.add(text1);

final?JPasswordField?text2?=?new?JPasswordField();

text2.setBounds(50,?45,?130,?20);

jFrame.add(text2);

JButton?button?=?new?JButton("Login");

button.setBounds(10,?75,?170,?40);

button.addActionListener(new?ActionListener()?{

@Override

public?void?actionPerformed(ActionEvent?e)?{

if(userName.equals(text1.getText())??passwrod.equals(text2.getText()))?{

JOptionPane.showMessageDialog(null,?"登陸成功誤",?"提示",?JOptionPane.INFORMATION_MESSAGE);

}?else?{

JOptionPane.showMessageDialog(null,?"錯誤",?"提示",?JOptionPane.ERROR_MESSAGE);

text1.setText("");

text2.setText("");

}

}

});

jFrame.add(button);

jFrame.setVisible(true);

}

}

我有一個微信公眾號,經(jīng)常會分享一些Java技術(shù)相關(guān)的干貨,還有一些學(xué)習(xí)資源。

如果你喜歡我的分享,可以用微信搜索“Java團長”或者“javatuanzhang”關(guān)注。


本文名稱:java用戶登入界面代碼 java登錄界面代碼簡單
文章出自:http://weahome.cn/article/doosiji.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部