qq登陸代碼java 登錄頁面的代碼

登QQ時說Java錯誤時是什么意思

很有可能是手機QQ記錄你登陸信息的文件損壞,或者丟失,(類似IE的cookie)。任何程序的登陸機制都是獲取用戶名和密碼,然后到服務(wù)器存儲用戶信息的數(shù)據(jù)庫中去比對實現(xiàn)的。你登自己的QQ不行,而登別人的QQ可以,就是說明,你的QQ和服務(wù)器的交互是沒有問題的,唯一可能的原因就是你使用了“自動登錄”功能,而手機中存儲你登陸信息的文件又有問題。

創(chuàng)新互聯(lián)建站服務(wù)項目包括絳縣網(wǎng)站建設(shè)、絳縣網(wǎng)站制作、絳縣網(wǎng)頁制作以及絳縣網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,絳縣網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到絳縣省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

解決方案:

1.去除自動登錄,手動輸入QQ號和密碼

2.如果不行,建議重啟手機

3.如果還不行,重裝QQ

希望可以幫到你

怎么用java打開qq

java實現(xiàn)簡單QQ登陸界面:

1.生成界面的java代碼

package?QQ2014;

import?javax.swing.*;

import?java.awt.*;

import?java.awt.event.*;

public?class?QQ2014?{

//創(chuàng)建登陸界面類

public?void?showLoginFrame(){

//創(chuàng)建船體對象

JFrame?loginFrame=new?JFrame();

//設(shè)置大小,位置,標題

loginFrame.setSize(300,200);

loginFrame.setTitle("QQ2014");

loginFrame.setLocationRelativeTo(null);

//創(chuàng)建流式分布對象

FlowLayout?layout=new?FlowLayout();

loginFrame.setLayout(layout);

//創(chuàng)建賬戶名,密碼和輸入框

JLabel?user_name=new?JLabel("賬號:");

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

JTextField?field_name=new?JTextField(20);

JPasswordField?field_password=new?JPasswordField(20);

//創(chuàng)建登陸,重置按鈕

JButton?button_reset=new?JButton("重置");

JButton?button_login=new?JButton("登陸");

//設(shè)置窗體可見

loginFrame.setVisible(true);

//創(chuàng)建事件監(jiān)聽對象

ActionListener?action_listener1=new?ActionListener(){

public?void?actionPerformed(ActionEvent?e){

String?name=field_name.getText();

String?password=field_password.getText();

if("zhaoxin".equals(name)"123".equals(password))

{

showIndexFrame();

loginFrame.setDefaultCloseOperation(3);

loginFrame.setVisible(false);

}

else{

System.out.println("密碼錯誤,重新輸入!");

}

}

};

ActionListener?action_listener2=new?ActionListener(){

public?void?actionPerformed(ActionEvent?e){

field_name.setText("");

field_password.setText("");

}

};

//將文本輸入框,按鈕,事件監(jiān)聽對象添加

loginFrame.add(user_name);

loginFrame.add(field_name);

loginFrame.add(user_password);

loginFrame.add(field_password);

loginFrame.add(button_reset);

loginFrame.add(button_login);

button_reset.addActionListener(action_listener2);

button_login.addActionListener(action_listener1);

}

public?void?showIndexFrame(){

//創(chuàng)建窗體對象

JFrame?indexFrame=new?JFrame();

indexFrame.setSize(200,500);

indexFrame.setTitle("QQ好友列表");

indexFrame.setLocationRelativeTo(null);

//設(shè)置流式分布對象

FlowLayout?layout=new?FlowLayout(FlowLayout.CENTER,100,10);

indexFrame.setLayout(layout);

//創(chuàng)建好友按鈕

for(int?i=0;i10;i++)

{

JButton?button_friend=new?JButton("friend"+i);

//創(chuàng)建動作事件監(jiān)聽對象

ActionListener?action_listener=new?ActionListener()

{

public?void?actionPerformed(ActionEvent?e)

{

showChatFrame();

indexFrame.setVisible(false);

indexFrame.setDefaultCloseOperation(3);

}

};

button_friend.addActionListener(action_listener);

indexFrame.add(button_friend);

}

//設(shè)置窗體可見

indexFrame.setVisible(true);

}

public?void?showChatFrame(){

//創(chuàng)建窗體,大小,位置,標題

JFrame?chatFrame=new?JFrame();

chatFrame.setSize(400,400);

chatFrame.setTitle("正在聊天中...");

chatFrame.setLocationRelativeTo(null);

//創(chuàng)建聊天記錄,輸入域

JTextArea?area_input=new?JTextArea(10,30);

JTextArea?area_record=new?JTextArea(5,30);

//創(chuàng)建流式分布對象

FlowLayout?layout=new?FlowLayout(FlowLayout.CENTER,0,10);

chatFrame.setLayout(layout);

//創(chuàng)建發(fā)送,關(guān)閉按扭

JButton?button_send=new?JButton("發(fā)送");

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

//創(chuàng)建動作事件監(jiān)聽對象

ActionListener?action_listener1=new?ActionListener()

{

public?void?actionPerformed(ActionEvent?e){

area_record.setText(area_record.getText()+"\n"+area_input.getText());

area_input.setText("");

}

};

ActionListener?action_listener2=new?ActionListener()

{

public?void?actionPerformed(ActionEvent?e){

chatFrame.setVisible(false);

chatFrame.setDefaultCloseOperation(3);

}

};

//設(shè)置窗體可見

chatFrame.setVisible(true);

//添加按鈕,事件監(jiān)聽對象

chatFrame.add(area_record);

chatFrame.add(area_input);

chatFrame.add(button_send);

chatFrame.add(button_close);

button_send.addActionListener(action_listener1);

button_close.addActionListener(action_listener2);

}

}

復(fù)制代碼

2.java?main方法調(diào)用

package?QQ2014;

public?class?Test?{

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

QQ2014?qq=new?QQ2014();

qq.showLoginFrame();

}

}

用java怎么實現(xiàn)QQ登錄界面?

用java做QQ登錄界面的寫法如下:

package ch10;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

1、//定義該類繼承自JFrame,實現(xiàn)ActionListener接口

public class LoginTest extends JFrame implements ActionListener

{

2、//創(chuàng)建JPanel對象

private JPanel jp=new JPanel();

3、//創(chuàng)建3個標并加入數(shù)組

JLabel name = new JLabel("請輸入用戶名");

JLabel password = new JLabel("請輸入密碼");

JLabel show = new JLabel("");

private JLabel[] jl={name,password,show};

4、//創(chuàng)建登陸和重置按扭并加入數(shù)組

JButton login = new JButton("登陸");

JButton reset = new JButton("重置");

private JButton[] jb={login,reset};

5、//創(chuàng)建文本框以及密碼框

private JTextField jName=new JTextField();

private JPasswordField jPassword =new JPasswordField();

public LoginTest()

{

6、//設(shè)置布局管理器為空布局,這里自己擺放按鈕、標簽和文本框

jp.setLayout(null);

for(int i=0;i2;i++)

{

7、//設(shè)置標簽和按扭的位置與大小

jl[i].setBounds(30,20+40*i,180,20);

jb[i].setBounds(30+110*i,100,80,20);

8、//添加標簽和按扭到JPanel容器中

jp.add(jl[i]);

jp.add(jb[i]);

//為2個按鈕注冊動作事件監(jiān)聽器

jb[i].addActionListener(this);

}

9、//設(shè)置文本框的位置和大小,注意滿足美觀并足夠用戶名的長度

jName.setBounds(130,15,100,20);

10、//添加文本框到JPanel容器中

jp.add(jName);

11、//為文本框注冊動作事件監(jiān)聽器

jName.addActionListener(this);

12、//設(shè)置密碼框的位置和大小,注意滿足美觀和足夠密碼的長度

jPassword.setBounds(130,60,100,20);

13、//添加密碼框到JPanel容器中

jp.add(jPassword);

14、//設(shè)置密碼框中的回顯字符,這里設(shè)置美元符號

jPassword.setEchoChar('$');

15、//為密碼框注冊動作事件監(jiān)聽器

jPassword.addActionListener(this);

16、//設(shè)置用于顯示登陸狀態(tài)的標簽大小位置,并將其添加進JPanel容器

jl[2].setBounds(10,180,270,20);

jp.add(jl[2]);

17、//添加JPanel容器到窗體中

this.add(jp);

18、//設(shè)置窗體的標題、位置、大小、可見性及關(guān)閉動作

this.setTitle("登陸窗口");

this.setBounds(200,200,270,250);

this.setVisible(true);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

19、//實現(xiàn)動作監(jiān)聽器接口中的方法actionPerformed

public void actionPerformed(ActionEvent e)

{

20、//如果事件源為文本框

if(e.getSource()==jName)

{

21、//切換輸入焦點到密碼框

jPassword.requestFocus();

}

22、//如果事件源為重置按扭

else if(e.getSource()==jb[1])

{

23、//清空姓名文本框、密碼框和show標簽中的所有信息

jl[2].setText("");

jName.setText("");

jPassword.setText("");

24、//讓輸入焦點回到文本框

jName.requestFocus();

}

25、//如果事件源為登陸按鈕,則判斷登錄名和密碼是否正確

else

{

26、//判斷用戶名和密碼是否匹配

if(jName.getText().equals("lixiangguo")

String.valueOf(jPassword.getPassword()).equals("19801001"))

{

27、jl[2].setText("登陸成功,歡迎您的到來!");

}

else

{

28、jl[2].setText("對不起,您的用戶名或密碼錯誤!");

}

}

}

public static void main(String[] args)

{

29、//創(chuàng)建LoginTest窗體對象

new LoginTest();

}

}

當前題目:qq登陸代碼java 登錄頁面的代碼
網(wǎng)頁鏈接:http://bm7419.com/article48/ddepjhp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、標簽優(yōu)化、品牌網(wǎng)站設(shè)計、網(wǎng)站策劃、App設(shè)計、網(wǎng)站設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)