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

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

登陸窗口java代碼下載,登陸窗口java代碼下載

用JAVA語言編程實現(xiàn)一個用戶登錄窗口

方法一:

岐山ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!

采用JOptionPane中的一個非常有用的靜態(tài)方法 showOptionPane();

源碼如下:

import java.awt.Color;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.JLabel;

import javax.swing.JTextField;

import javax.swing.JPasswordField;

import javax.swing.JOptionPane;

import javax.swing.BoxLayout;

import javax.swing.Box;

import javax.swing.BorderFactory;

public class Login1 {

public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {

createAndShowGUI();

}

});

}

static void createAndShowGUI() {

JFrame mainFrame = new JFrame();

mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

mainFrame.setBounds(250,250,400,300);

mainFrame.setVisible(false);

usernameField = new JTextField(10);

passwordField = new JPasswordField(10);

Object[] options = {"登錄","取消"};

int i = JOptionPane.showOptionDialog(null,createLoginPanel(),"登錄信息",JOptionPane.DEFAULT_OPTION,JOptionPane.PLAIN_MESSAGE,null,options,options[0]);

if(i==0) {

String username = usernameField.getText();

String password = passwordField.getText();

if(!username.equals("") !password.equals("")) {

mainFrame.getContentPane().add(new JLabel("用戶名:"+username+" 密碼是:"+password,JLabel.CENTER));

mainFrame.show();

}

else {

JOptionPane.showMessageDialog(null,"用戶名和密碼不能為空","提示",JOptionPane.WARNING_MESSAGE);

System.exit(1);

}

}

else System.exit(0);

}

static JPanel createLoginPanel() {

JPanel ret = new JPanel();

JPanel usernamePanel = new JPanel();

usernamePanel.add(new JLabel("用戶名:",JLabel.RIGHT));

usernamePanel.add(usernameField);

JPanel passwordPanel = new JPanel();

passwordPanel.add(new JLabel("密 碼:",JLabel.RIGHT));

passwordPanel.add(passwordField);

Box box = new Box(BoxLayout.Y_AXIS);

box.add(usernamePanel); box.add(passwordPanel);

ret.add(box);

ret.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(244,144,44)),"填寫登錄信息"));

return ret;

}

static JFrame mainFrame = null;

static JTextField usernameField = null;

static JPasswordField passwordField = null;

}

運(yùn)行:

javac -deprecation Login1.java

java Login

(因為有一個過期的API,所以用了 -deprecation 命令)

方法二,使用了兩個JFrame類共同實現(xiàn),第一次顯示第一個frame,當(dāng)點了登錄后且操作合法時,第一個窗口就被釋放了 dispose();再顯示第二個窗口:

源碼如下:

import java.awt.Color;

import java.awt.BorderLayout;

import java.awt.event.*;

import javax.swing.*;

public class Login2 {

public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {

public void run() {

createAndShowGUI();

}

});

}

static void createAndShowGUI() {

//////////////////////////////////////////////////////////////

loginWindow = new JFrame("登錄信息");

loginWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

loginWindow.setBounds(350,350,250,200);

loginWindow.setResizable(false);

JPanel usernamePanel = new JPanel();

usernamePanel.add(new JLabel("用戶名:",JLabel.CENTER));

usernamePanel.add(usernameField);

JPanel passwordPanel = new JPanel();

passwordPanel.add(new JLabel("密 碼:",JLabel.CENTER));

passwordPanel.add(passwordField);

Box box = new Box(BoxLayout.Y_AXIS);

box.add(usernamePanel); box.add(passwordPanel);

JPanel infoPanel = new JPanel();

infoPanel.add(box);

infoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(244,144,44)),"填寫登錄信息"));

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

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

submitButton.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

String username = usernameField.getText();

String password = passwordField.getText();

if(!username.equals("") !password.equals("")) {

loginWindow.dispose();

mainFrame.getContentPane().add(new JLabel("用戶名:"+username+" 密碼是:"+password,JLabel.CENTER));

mainFrame.setVisible(true);

}

else {

JOptionPane.showMessageDialog(null,"用戶名和密碼不能為空","提示",JOptionPane.WARNING_MESSAGE);

System.exit(1);

}

}

});

cancelButton.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

System.exit(0);

}

});

JPanel buttonPanel = new JPanel();

buttonPanel.add(submitButton); buttonPanel.add(cancelButton);

loginWindow.getContentPane().add(infoPanel,BorderLayout.CENTER);

loginWindow.getContentPane().add(buttonPanel,BorderLayout.SOUTH);

loginWindow.getContentPane().add(new JPanel(),BorderLayout.EAST);

loginWindow.getContentPane().add(new JPanel(),BorderLayout.WEST);

loginWindow.setVisible(true);

/////////////////////////////////////////////////////////////////

mainFrame = new JFrame();

mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

mainFrame.setBounds(250,250,400,300);

mainFrame.setVisible(false);

}

static JFrame loginWindow,mainFrame;

static final JTextField usernameField = new JTextField(10);

static final JPasswordField passwordField = new JPasswordField(10);

}

運(yùn)行:

javac -deprecation Login2.java

java Login2

登陸界面的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寫一個登陸界面代碼。

概述

具體框架使用jframe,文本框組件:JTextField;密碼框組件:JPasswordField;標(biāo)簽組件:JLabel;復(fù)選框組件:JCheckBox;單選框組件:JRadioButton;按鈕組件JButton。

登錄界面:

代碼實例

import javax.swing.*;

import java.awt.*; ? //導(dǎo)入必要的包

public class denglu extends JFrame{

JTextField jTextField ;//定義文本框組件

JPasswordField jPasswordField;//定義密碼框組件

JLabel jLabel1,jLabel2;

JPanel jp1,jp2,jp3;

JButton jb1,jb2; //創(chuàng)建按鈕

public denglu(){

jTextField = new JTextField(12);

jPasswordField = new JPasswordField(13);

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

jLabel2 = new JLabel("密碼");

jb1 = new JButton("確認(rèn)");

jb2 = new JButton("取消");

jp1 = new JPanel();

jp2 = new JPanel();

jp3 = new JPanel();

//設(shè)置布局

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

jp1.add(jLabel1);

jp1.add(jTextField);//第一塊面板添加用戶名和文本框

jp2.add(jLabel2);

jp2.add(jPasswordField);//第二塊面板添加密碼和密碼輸入框

jp3.add(jb1);

jp3.add(jb2); //第三塊面板添加確認(rèn)和取消

// ? ? ? ?jp3.setLayout(new FlowLayout()); ?//因為JPanel默認(rèn)布局方式為FlowLayout,所以可以注銷這段代碼.

this.add(jp1);

this.add(jp2);

this.add(jp3); ?//將三塊面板添加到登陸框上面

//設(shè)置顯示

this.setSize(300, 200);

//this.pack();

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.setVisible(true);

this.setTitle("登陸");

}

public static void main(String[] args){

new denglu();

}

}

拓展內(nèi)容

java swing包

Swing 是一個為Java設(shè)計的GUI工具包。

Swing是JAVA基礎(chǔ)類的一部分。

Swing包括了圖形用戶界面(GUI)器件如:文本框,按鈕,分隔窗格和表。

Swing提供許多比AWT更好的屏幕顯示元素。它們用純Java寫成,所以同Java本身一樣可以跨平臺運(yùn)行,這一點不像AWT。它們是JFC的一部分。它們支持可更換的面板和主題(各種操作系統(tǒng)默認(rèn)的特有主題),然而不是真的使用原生平臺提供的設(shè)備,而是僅僅在表面上模仿它們。這意味著你可以在任意平臺上使用JAVA支持的任意面板。輕量級組件的缺點則是執(zhí)行速度較慢,優(yōu)點就是可以在所有平臺上采用統(tǒng)一的行為。

概念解析:

JFrame?– java的GUI程序的基本思路是以JFrame為基礎(chǔ),它是屏幕上window的對象,能夠最大化、最小化、關(guān)閉。

JPanel?– Java圖形用戶界面(GUI)工具包swing中的面板容器類,包含在javax.swing 包中,可以進(jìn)行嵌套,功能是對窗體中具有相同邏輯功能的組件進(jìn)行組合,是一種輕量級容器,可以加入到JFrame窗體中。。

JLabel?– JLabel 對象可以顯示文本、圖像或同時顯示二者。可以通過設(shè)置垂直和水平對齊方式,指定標(biāo)簽顯示區(qū)中標(biāo)簽內(nèi)容在何處對齊。默認(rèn)情況下,標(biāo)簽在其顯示區(qū)內(nèi)垂直居中對齊。默認(rèn)情況下,只顯示文本的標(biāo)簽是開始邊對齊;而只顯示圖像的標(biāo)簽則水平居中對齊。

JTextField?–一個輕量級組件,它允許編輯單行文本。

JPasswordField?– 允許我們輸入了一行字像輸入框,但隱藏星號(*) 或點創(chuàng)建密碼(密碼)

JButton?– JButton 類的實例。用于創(chuàng)建按鈕類似實例中的 "Login"。

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

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

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編的登錄界面代碼:登錄后分別進(jìn)入管理員界面及用戶界面,依據(jù)是數(shù)據(jù)庫中的用戶名和密碼

分三個包,自己建個包,導(dǎo)進(jìn)去就ok了,數(shù)據(jù)庫是access的。

package 登錄;

import java.awt.EventQueue;

public class Cilent {

private JFrame frame;

private JTextField textField;

private JPasswordField passwordField;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

Cilent window = new Cilent();

window.frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

}

}

});

}

/**

* Create the application.

*/

public Cilent() {

initialize();

}

/**

* Initialize the contents of the frame.

*/

private void initialize() {

frame = new JFrame();

frame.setTitle("登陸界面");

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

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().setLayout(null);

frame.setResizable(false);

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

lblNewLabel.setBounds(38, 43, 80, 34);

frame.getContentPane().add(lblNewLabel);

textField = new JTextField();

textField.setBounds(155, 42, 227, 37);

frame.getContentPane().add(textField);

textField.setColumns(10);

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

label.setBounds(38, 115, 80, 34);

frame.getContentPane().add(label);

passwordField = new JPasswordField();

passwordField.setBounds(155, 115, 227, 37);

frame.getContentPane().add(passwordField);

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

btnNewButton.setBounds(60, 187, 115, 34);

frame.getContentPane().add(btnNewButton);

btnNewButton.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent arg0) {

// TODO Auto-generated method stub

UserCheck UC=new UserCheck(textField.getText(),String.valueOf(passwordField.getPassword()));

if(UC.getI()!=0) //有此用戶

{

frame.setVisible(false);

}

else

{

textField.setText("");

passwordField.setText("");

}

}

});

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

button.setBounds(242, 187, 115, 34);

frame.getContentPane().add(button);

button.addActionListener(new ActionListener() {

@Override

public void actionPerformed(ActionEvent arg0) {

// TODO Auto-generated method stub

textField.setText("");

passwordField.setText("");

}

});

}

}

/*****************************************************************/

package 登錄;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import 操作處理.UsersCL;

/**@author 20111024

* 檢測登錄的用戶在數(shù)據(jù)庫中有無,若沒有,則提示沒有此用戶,

* 若有,則判斷級別:普通用戶還是管理員。

*/

public class UserCheck {

private int i=0; //用戶級別:0不是用戶、1是管理員、2是普通用戶

UserCheck(String name ,String password)

{

String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";

String connectDB="jdbc:odbc:Students";

Statement stmt=null;

ResultSet rs=null;

Connection con=null;

try {

Class.forName(jdriver);

con=DriverManager.getConnection(connectDB);

stmt=con.createStatement();

String query="select * from users where name='"+name+"' and passwd='"+password+"'";

rs=stmt.executeQuery(query);

if(rs.next())

{

//數(shù)據(jù)庫中有此用戶,訪問成功

i=Integer.parseInt(rs.getString(3));

UsersCL UL=new UsersCL(i);

}

else

{

i=0; //沒有用戶是默認(rèn)是0級

}

} catch (ClassNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public int getI() {

return i;

}

}

/********************************************************************************************/

package 操作處理;

import java.awt.EventQueue;

public class UsersCL implements ActionListener{

private JFrame frame;

private JTextField textField;

private JTextField textField_1;

private JTextField textField_2;

private JTextField textField_3;

private int i=0;

private JLabel label_3;

private JTextField textField_4;

public UsersCL(int i) {

this.i=i;

frame = new JFrame();

frame.setTitle("用戶處理界面");

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

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.getContentPane().setLayout(null);

frame.setResizable(false);

frame.setVisible(true);

JLabel lblNewLabel = new JLabel("學(xué) 號");

lblNewLabel.setBounds(24, 32, 74, 29);

frame.getContentPane().add(lblNewLabel);

JLabel label = new JLabel("姓 名");

label.setBounds(24, 71, 74, 29);

frame.getContentPane().add(label);

JLabel label_1 = new JLabel("年 齡");

label_1.setBounds(24, 110, 74, 29);

frame.getContentPane().add(label_1);

label_3 = new JLabel("性 別");

label_3.setBounds(24, 149, 74, 29);

frame.getContentPane().add(label_3);

JLabel label_2 = new JLabel("狀 態(tài)");

label_2.setBounds(24, 195, 74, 29);

frame.getContentPane().add(label_2);

textField = new JTextField();

textField.setBounds(101, 34, 113, 25);

frame.getContentPane().add(textField);

textField.setColumns(10);

textField_1 = new JTextField();

textField_1.setColumns(10);

textField_1.setBounds(101, 73, 113, 25);

frame.getContentPane().add(textField_1);

textField_2 = new JTextField();

textField_2.setColumns(10);

textField_2.setBounds(101, 112, 113, 25);

frame.getContentPane().add(textField_2);

textField_3 = new JTextField();

textField_3.setEditable(false);

textField_3.setColumns(10);

textField_3.setBounds(101, 199, 288, 25);

frame.getContentPane().add(textField_3);

textField_4 = new JTextField();

textField_4.setColumns(10);

textField_4.setBounds(101, 149, 113, 25);

frame.getContentPane().add(textField_4);

if(1==i)

{

JButton btnNewButton = new JButton("追 加");

btnNewButton.setBounds(276, 41, 113, 29);

frame.getContentPane().add(btnNewButton);

btnNewButton.addActionListener(this);

btnNewButton.setActionCommand("追加");

JButton button_1 = new JButton("刪 除");

button_1.setBounds(276, 145, 113, 29);

frame.getContentPane().add(button_1);

button_1.addActionListener(this);

button_1.setActionCommand("刪除");

}

JButton button = new JButton("查 詢");

button.setBounds(276, 91, 113, 29);

frame.getContentPane().add(button);

button.addActionListener(this);

button.setActionCommand("查詢");

}

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

String name,age,sex,query=null;

int num,age1,count=0;

num=Integer.parseInt(textField.getText());

name=textField_1.getText();

age1=Integer.parseInt(textField_2.getText());

sex=textField_4.getText();

if(e.getActionCommand().equals("追加"))

{

query="insert into students values("+num+","+"'"+name+"',"+age1+",'"+sex+"');";

count=1;

}

else if(e.getActionCommand().equals("查詢"))

{

query="select * from students where XSB="+num+";";

count=2;

}

else if(e.getActionCommand().equals("刪除"))

{

query="delete from students where XSB="+num+" and name="+"'"+name+"'";

count=3;

}

Statement stmt=null;

ResultSet rs=null;

Connection con=null;

String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";

String connectDB="jdbc:odbc:Students";

String query1=null;

try {

Class.forName(jdriver);

con=DriverManager.getConnection(connectDB);

stmt=con.createStatement();

if(count==1)

{

query1="select * from students where XSB="+num+";";

rs=stmt.executeQuery(query1);

if(rs.next())

textField_3.setText("已經(jīng)由此記錄,不能追加!");

else

{

stmt.executeUpdate(query);

textField_3.setText("已經(jīng)追加完成!");

}

}

else if(2==count)

{

stmt.executeQuery(query);

rs=stmt.executeQuery(query);

if(rs.next())

{

textField_3.setText("已查找到此記錄!");

}

else

{

textField_3.setText("沒有此記錄,可以追加!");

}

}

else if(3==count)

{

query1="select * from students where XSB="+num+" and name="+"'"+name+"'";

rs=stmt.executeQuery(query1);

if(rs.next())

{

stmt.executeUpdate(query);

textField_3.setText("已刪除此記錄!");

}

else

textField_3.setText("無此記錄!");

}

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

finally{

//關(guān)閉資源

if(stmt!=null){

try {

stmt.close();

} catch (Exception e2) {

// TODO: handle exception

}

stmt=null;

}

if(con!=null){

try {

con.close();

} catch (Exception e2) {

// TODO: handle exception

}

con=null;

}

}

}

}

JAVA 制作登陸窗口

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class Login extends JFrame{

nbsp;public Login() {

nbsp;nbsp;setLayout(new GridLayout(1,2));//網(wǎng)格布局,1行2列,放置左面板和右面板

nbsp;nbsp;setTitle("發(fā)表iPhone說說");//設(shè)置窗口標(biāo)題

nbsp;nbsp;setSize(550,300);//設(shè)置大小

nbsp;nbsp;setLocationRelativeTo(null);//設(shè)置窗口位置

nbsp;nbsp;setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//設(shè)置窗口關(guān)閉按鈕動作

nbsp;nbsp;//左面板

nbsp;nbsp;JPanel leftPanel = new JPanel();

nbsp;nbsp;leftPanel.setBorder(BorderFactory.createTitledBorder("登錄手機(jī)騰訊網(wǎng)"));//給左面板加上邊框,并添加文字

nbsp;nbsp;leftPanel.setLayout(new BorderLayout());

nbsp;nbsp;JPanel leftPanelTop = new JPanel();

nbsp;nbsp;JPanel leftPanelBottom = new JPanel();

nbsp;nbsp;leftPanel.add(leftPanelTop, BorderLayout.CENTER);

nbsp;nbsp;leftPanel.add(leftPanelBottom, BorderLayout.SOUTH);

nbsp;nbsp;leftPanelTop.setLayout(new GridLayout(3,2));//網(wǎng)格布局,3行2列

nbsp;nbsp;nbsp;nbsp;nbsp;

nbsp;nbsp;//========================請在下面寫上你的代碼

nbsp;nbsp;JLabel qq = new JLabel("QQ號碼");

nbsp;nbsp;JTextField qqNum = new JTextField();

nbsp;nbsp;JLabel pwd = new JLabel("QQ密碼");

nbsp;nbsp;JPasswordFieldnbsp; qqPwd = new JPasswordField();

nbsp;nbsp;JLabel verify = new JLabel("驗證碼");

nbsp;nbsp;JTextField qqVer = new JTextField();

nbsp;nbsp;leftPanelTop.add(qq);

nbsp;nbsp;leftPanelTop.add(qqNum);

nbsp;nbsp;leftPanelTop.add(pwd);

nbsp;nbsp;leftPanelTop.add(qqPwd);

nbsp;nbsp;leftPanelTop.add(verify);

nbsp;nbsp;leftPanelTop.add(qqVer);

nbsp;nbsp;leftPanelBottom.setLayout(new GridLayout(1,2));

nbsp;nbsp;JLabel i_vc = new JLabel(new ImageIcon("images/VerificationCode.jpg"));//這是顯示驗證碼的標(biāo)簽,幫你寫好了,后面直接調(diào)用即可。

nbsp;nbsp;JButton bt1 = new JButton("帳號密碼登陸");

nbsp;nbsp;JButton bt2 = new JButton("帶驗證碼登陸");

nbsp;nbsp;JPanel btPanel = new JPanel();

nbsp;nbsp;btPanel.setLayout(new GridLayout(2,1));

nbsp;nbsp;btPanel.add(bt1);

nbsp;nbsp;btPanel.add(bt2);

nbsp;nbsp;leftPanelBottom.add(i_vc);

nbsp;nbsp;leftPanelBottom.add(btPanel);

nbsp;nbsp;//============================================

nbsp;nbsp;add(leftPanel);//將左面板放入窗體中

nbsp;nbsp;//右面板

nbsp;nbsp;JPanel rightPanel = new JPanel();

nbsp;nbsp;rightPanel.setBorder(BorderFactory.createTitledBorder("發(fā)表iPhone說說"));//給右面板加上邊框,并添加文字

nbsp;nbsp;//========================請在下面寫上你的代碼

nbsp;nbsp;JTextArea msg = new JTextArea();

nbsp;nbsp;JButton submit = new JButton("馬上發(fā)表說說");

nbsp;nbsp;rightPanel.setLayout(new BorderLayout());

nbsp;nbsp;rightPanel.add(msg, BorderLayout.CENTER);

nbsp;nbsp;rightPanel.add(submit, BorderLayout.SOUTH);

nbsp;nbsp;//============================================

nbsp;nbsp;add(rightPanel);//將右面板放入窗體中

nbsp;nbsp;setVisible(true);//使窗體可見

nbsp;}

nbsp;public static void main(String[] args){

nbsp;nbsp;new Login();

nbsp;}

}


當(dāng)前題目:登陸窗口java代碼下載,登陸窗口java代碼下載
文章位置:http://weahome.cn/article/hceddg.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部