当前位置:首页 » 编程语言 » java登录qq

java登录qq

发布时间: 2023-03-04 15:45:38

Ⅰ 用java怎么实现QQ登录界面

用java做QQ登录界面的写法如下:

package ch10;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

1、//定义该类继承自JFrame,实现ActionListener接口

public class LoginTest extends JFrame implements ActionListener

{

2、//创建JPanel对象

private JPanel jp=new JPanel();

3、//创建3个标并加入数组

JLabel name = new JLabel("请输入用户名");

JLabel password = new JLabel("请输入密码");

JLabel show = new JLabel("");

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

4、//创建登陆和重置按扭并加入数组

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

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

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

5、//创建文本框以及密码框

private JTextField jName=new JTextField();

private JPasswordField jPassword =new JPasswordField();

public LoginTest()

{

6、//设置布局管理器为空布局,这里自己摆放按钮、标签和文本框

jp.setLayout(null);

for(int i=0;i<2;i++)

{

7、//设置标签和按扭的位置与大小

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个按钮注册动作事件监听器

jb[i].addActionListener(this);

}

9、//设置文本框的位置和大小,注意满足美观并足够用户名的长度

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

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

jp.add(jName);

11、//为文本框注册动作事件监听器

jName.addActionListener(this);

12、//设置密码框的位置和大小,注意满足美观和足够密码的长度

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

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

jp.add(jPassword);

14、//设置密码框中的回显字符,这里设置美元符号

jPassword.setEchoChar('$');

15、//为密码框注册动作事件监听器

jPassword.addActionListener(this);

16、//设置用于显示登陆状态的标签大小位置,并将其添加进JPanel容器

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

jp.add(jl[2]);

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

this.add(jp);

18、//设置窗体的标题、位置、大小、可见性及关闭动作

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

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

this.setVisible(true);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

19、//实现动作监听器接口中的方法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、//创建LoginTest窗体对象

new LoginTest();

}

}

Ⅱ 手机QQ2012JAVA版为什么不能登录QQ

你的手机要是只能支持通用版的,那么不能兼容2012版的,下载了也用不了。如果支持2012可以到手机腾讯网的下载栏去下载。还有检测下
你手机上面有没有别的设置了
对了
你还可以试着关机在开机重新登录试试
如果不行要么该软件原本有问题
要么你手机上面的问题了

Ⅲ 请问用java程序模拟qq登录界面的代码怎么写啊

太简单了!你看看! package dyno.swing.beans.qq; import javax.swing.*; import javax.swing.event.MouseInputListener; import org.jvnet.substance.skin.; /*import org.jvnet.substance.skin.SubstanceModerateLookAndFeel; import org.jvnet.substance.skin.;*/ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Scanner; public class QQLogin extends JFrame implements MouseInputListener,ActionListener{ JLabel guanggao,beijing,wenzi,she,zhanghaowb,qq1,dengluzhuangtai; // JTextField zhanghao; JPopupMenu haoma; JComboBox zhanghao; JPasswordField mima; JCheckBox jizhumima,zidongdenglu; JButton denglu,chashamuma; JProgressBar jpb; SimThread activity; Timer activityMonitor; String name,qq; Socket s; public QQLogin() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (ClassNotFoundException e1) { // TODO 自动生成 catch 块 e1.printStackTrace(); } catch (InstantiationException e1) { // TODO 自动生成 catch 块 e1.printStackTrace(); } catch (IllegalAccessException e1) { // TODO 自动生成 catch 块 e1.printStackTrace(); } catch ( e1) { // TODO 自动生成 catch 块 e1.printStackTrace(); } chashamuma = new JButton("查杀木马"); chashamuma.setBounds(240, 155,85, 20); this.add(chashamuma); jpb = new JProgressBar(); jpb.setStringPainted(true); jpb.setBounds(100, 240, 200, 15); this.add(jpb); chashamuma.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ jpb.setMaximum(1000);//设置进度栏的最大值 activity=new SimThread(1000); activity.start();//启动线程 activityMonitor.start();//启动定时器 chashamuma.setEnabled(false);//禁止按钮 } }); activityMonitor=new Timer(100,new ActionListener(){//每0.5秒执行一次 public void actionPerformed(ActionEvent e){//以下动作将在事件调度线程中运行,十分安全 int current=activity.getCurrent();//得到线程的当前进度 jpb.setValue(current);//更新进度栏的值 if(current==activity.getTarget()){//如果到达目标值 activityMonitor.stop();//终止定时器 chashamuma.setEnabled(true);//激活按钮 } } }); dengluzhuangtai = new JLabel(new ImageIcon("zaixianzhuangtai.jpg")); dengluzhuangtai.setBounds(75, 145, 35, 30); this.add(dengluzhuangtai); dengluzhuangtai.addMouseListener(this); denglu = new JButton("登录"); denglu.setBounds(140, 155, 80, 20); this.add(denglu); this.setAlwaysOnTop(true); zidongdenglu = new JCheckBox("自动登录"); zidongdenglu.setBounds(200, 190, 100, 30); this.add(zidongdenglu); jizhumima = new JCheckBox("记住密码"); jizhumima.setBounds(100, 190, 100, 30); // jizhumima.setBackground(new Color(228, 244, 255)); this.add(jizhumima); haoma = new JPopupMenu(); /* zhanghao = new JTextField(20); zhanghao.setBounds(120, 78, 135, 20); zhanghao.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.WHITE)); zhanghao.setFont(new Font("宋体",Font.PLAIN,13)); this.add(zhanghao);*/ // zhanghaowb = new JLabel(new ImageIcon("2.png")); // zhanghaowb.setBounds(90, 73, 194, 31); // jiantou = new JLabel(new ImageIcon("jiantou.png")); // jiantou.setBounds(256, 78, 23, 21); // jiantou.addMouseListener(this); // this.add(jiantou); // this.add(zhanghaowb); chashamuma.addActionListener(this); mima = new JPasswordField(); mima.setEchoChar('*'); mima.setFont(new Font("宋体",Font.PLAIN,13)); mima.setBounds(100, 113, 150, 20); this.add(mima); zhanghao = new JComboBox(); zhanghao.setEditable(true); zhanghao.setBounds(100, 78, 150, 20); zhanghao.setFont(new Font("宋体",Font.PLAIN,13)); this.add(zhanghao); guanggao = new JLabel(new ImageIcon("guanggao.gif")); guanggao.setBounds(0, 0, 334, 64); beijing = new JLabel(new ImageIcon("beijing.jpg")); beijing.setBounds(0, 64, 334, 154); wenzi = new JLabel(new ImageIcon("wenzi.jpg")); wenzi.setBounds(30, 75, 50, 100); denglu.addActionListener(this); // zhanghaowb.addMouseListener(this); // zhanghao.addMouseListener(this); this.add(wenzi); this.add(beijing); this.setLayout(null); this.add(guanggao); this.setVisible(true); this.setDefaultCloseOperation(3); this.setSize(340, 250); this.setLocationRelativeTo(null); } public static void main(String[] args) { /*JFrame.(true); try { UIManager.setLookAndFeel(new ()) ; UIManager.setLookAndFeel("org.jvnet.substance.skin."); } catch (Exception e) { System.out.println("Substance Raven Graphite failed to initialize"); } SwingUtilities.invokeLater(new Runnable() { public void run() { QQLogin w = new QQLogin(); w.setVisible(true); } });*/ new QQLogin(); } public void mouseClicked(MouseEvent e) { // TODO 自动生成方法存根 } public void mouseEntered(MouseEvent e) { if(e.getSource() == dengluzhuangtai) { dengluzhuangtai.setIcon(new ImageIcon("zaixianzhuangtaidian.jpg")); } } public void mouseExited(MouseEvent e) { if(e.getSource() == dengluzhuangtai) { dengluzhuangtai.setIcon(new ImageIcon("zaixianzhuangtai.jpg")); } } public void mousePressed(MouseEvent e) { // TODO 自动生成方法存根 } public void mouseReleased(MouseEvent e) { // TODO 自动生成方法存根 } public void mouseDragged(MouseEvent e) { // TODO 自动生成方法存根 } public void mouseMoved(MouseEvent e) { // TODO 自动生成方法存根 } public class liaotianchuangkou { } class SimThread extends Thread{//线程类 private int current;//进度栏的当前值 private int target;//进度栏的最大值 public SimThread(int t){ current=0; target=t; } public int getTarget(){ return target; } public int getCurrent(){ return current; } public void run(){//线程体 try{ while (current<target && !interrupted()){//如果进度栏的当前值小于目标值并且线程没有被中断 sleep(10); current++; if(current == 700) { sleep(3000); } else if(current == 730) { sleep(1000); } } }catch (InterruptedException e){} } } public void actionPerformed(ActionEvent e) { if(e.getSource() == chashamuma) { this.setBounds(300, 300, 340, 300); } else if(e.getSource() == denglu) { String zh = (String) zhanghao.getSelectedItem(); System.out.println(zhanghao.getSelectedItem()); // System.out.println(zhanghao.getItemAt(0)); char [] str = mima.getPassword(); String mima = String.valueOf(str);; System.out.println(mima); // Sql login = new Sql(); // if(login.login(zh,mima)) // { try { s = new Socket("127.0.0.1",8888); System.out.println(s); PrintWriter pw; Scanner sc; pw = new PrintWriter(s.getOutputStream(),true); sc = new Scanner(s.getInputStream()); String str2 = "login#289872400198724#"+zh+"#289872400198724#"+mima; System.out.println(str2); pw.println(str2); String str3 = sc.nextLine(); String yanzheng[] = str3.split("#"); System.out.println(str3); if(yanzheng[0].equals("true")) { System.out.println("登陆成功!"); name = yanzheng[1]; qq = yanzheng[2]; // this.setVisible(false); // Thread.sleep(5000); System.out.println("woao"+name); System.out.println("woai"+qq); Logined logined = new Logined(name,qq); this.setVisible(false); } else { JOptionPane.showMessageDialog(this, "用户名或密码错误!", "用户名或密码错误!", 0); } } catch (UnknownHostException e2) { // TODO 自动生成 catch 块 e2.printStackTrace(); } catch (IOException e2) { // TODO 自动生成 catch 块 e2.printStackTrace(); } /*try { login.rs = login.stat.executeQuery("select * from qquser where username='"+zh+"' and password = '"+mima+"'"); boolean flag = login.rs.next(); if(flag == true) { name = login.rs.getString("name"); qq = login.rs.getString("username"); } else { }*/ // } catch (SQLException e1) { // TODO 自动生成 catch 块 // e1.printStackTrace(); // } } else { JOptionPane.showMessageDialog(this, "用户名或密码错误", "输入错误", 0); } // this.setVisible(false); //new Logined(); } }

Ⅳ javaqq还能登陆吗

JAVA版本的QQ已经无法登录了,因为现在智能手机普及,很少有人用JAVA版本的QQ,有关服务器已经停止工作。

Ⅳ qq 第三方登录 java sdk怎么用

方法/步骤

准备工作

在正式接入之前你需要了解以下名词的含义:

1. appid:应用的唯一标识。在OAuth2.0认证过程中,appid的值即为oauth_consumer_key的值。

2. appkey:appid对应的密钥,访问用户资源时用来验证应用的合法性。在OAuth2.0认证过程中,appkey的值即为oauth_consumer_secret的值。

3. redirecturl:成功授权后的回调地址,必须是注册appid时填写的主域名下的地址,建议设置为网站首页或网站的用户中心。注意需要将url进行URLEncode。

4. access token:用来判断用户在本网站上的登录状态,具有3个月有效期,用户再次登录时自动刷新。

5. openid:是此网站上唯一对应用户身份的标识,网站可将此ID进行存储便于用户下次登录时辨识其身份,或将其与用户在网站上的原有帐号进行绑定。

第一步

要接入QQ登录,必不可少的是appid和appkey,通过申请接入QQ登录,按照相应步骤操作即可轻松获得,在此不做赘述。

第二步

在需要放置QQ登录按钮的页面加入下面SCRIPT代码:

<scripttype="text/javascript"src="http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js"data-appid="APPID"data-redirecturi="REDIRECTURI"charset="utf-8"></script>

PS:APPID和REDIRECTURI换成第一步申请所得到的对应内容,REDIRECTURI就是登录之后返回的回调地址,在申请页面自己填写,一般写网站主域名即可。注意:回调地址必须以http或https开头。

第三步

在页面放置一个元素节点用来展现登录按钮,并且指定其ID,如:

<div id="qq"></div>

然后在页面加入如下SCRIPT:

<scripttype="text/javascript">

QC.Login({

btnId:"qq"//插入按钮的节点id

});

</script>

这时就可以在页面看到如下效果:

如对这个展示效果不满意,也可以自定义登录按钮。

最后

提供一种代码接入思路,仅供参考:

QC.api("get_user_info", {}) //get_user_info是API参数

//指定接口访问成功的接收函数,s为成功返回Response对象

.success(function (s) {

//成功回调,通过s.data获取OpenAPI的返回数据

nick = s.data.nickname; //获得昵称

hearl = s.data.figureurl_qq_1; //获得头像

if (QC.Login.check()) {//判断是否登录

QC.Login.getMe(function (openId, accessToken) { //这里可以得到openId和accessToken

//下面可以调用自己的保存方法

……

});

}

})

//指定接口访问失败的接收函数,f为失败返回Response对象

.error(function (f) {

//失败回调

alert("获取用户信息失败!");

});

////指定接口完成请求后的接收函数,c为完成请求返回Response对象

//.complete(function (c) {

// //完成请求回调

// alert("获取用户信息完成!");

//});

Ⅵ 怎么用java打开qq

java实现简单QQ登陆界面:
1.生成界面的java代码
packageQQ2014;
importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
publicclassQQ2014{
//创建登陆界面类
publicvoidshowLoginFrame(){
//创建船体对象
JFrameloginFrame=newJFrame();
//设置大小,位置,标题
loginFrame.setSize(300,200);
loginFrame.setTitle("QQ2014");
loginFrame.setLocationRelativeTo(null);
//创建流式分布对象
FlowLayoutlayout=newFlowLayout();
loginFrame.setLayout(layout);
//创建账户名,密码和输入框
JLabeluser_name=newJLabel("账号:");
JLabeluser_password=newJLabel("密码:");
JTextFieldfield_name=newJTextField(20);
JPasswordFieldfield_password=newJPasswordField(20);
//创建登陆,重置按钮
JButtonbutton_reset=newJButton("重置");
JButtonbutton_login=newJButton("登陆");
//设置窗体可见
loginFrame.setVisible(true);
//创建事件监听对象
ActionListeneraction_listener1=newActionListener(){
publicvoidactionPerformed(ActionEvente){
Stringname=field_name.getText();
Stringpassword=field_password.getText();
if("zhaoxin".equals(name)&&"123".equals(password))
{
showIndexFrame();
loginFrame.setDefaultCloseOperation(3);
loginFrame.setVisible(false);
}
else{
System.out.println("密码错误,重新输入!");
}
}
};
ActionListeneraction_listener2=newActionListener(){
publicvoidactionPerformed(ActionEvente){
field_name.setText("");
field_password.setText("");
}
};
//将文本输入框,按钮,事件监听对象添加
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);
}
publicvoidshowIndexFrame(){
//创建窗体对象
JFrameindexFrame=newJFrame();
indexFrame.setSize(200,500);
indexFrame.setTitle("QQ好友列表");
indexFrame.setLocationRelativeTo(null);
//设置流式分布对象
FlowLayoutlayout=newFlowLayout(FlowLayout.CENTER,100,10);
indexFrame.setLayout(layout);
//创建好友按钮
for(inti=0;i<10;i++)
{
JButtonbutton_friend=newJButton("friend"+i);
//创建动作事件监听对象
ActionListeneraction_listener=newActionListener()
{
publicvoidactionPerformed(ActionEvente)
{
showChatFrame();
indexFrame.setVisible(false);
indexFrame.setDefaultCloseOperation(3);
}
};
button_friend.addActionListener(action_listener);
indexFrame.add(button_friend);
}
//设置窗体可见
indexFrame.setVisible(true);
}
publicvoidshowChatFrame(){
//创建窗体,大小,位置,标题
JFramechatFrame=newJFrame();
chatFrame.setSize(400,400);
chatFrame.setTitle("正在聊天中...");
chatFrame.setLocationRelativeTo(null);
//创建聊天记录,输入域
JTextAreaarea_input=newJTextArea(10,30);
JTextAreaarea_record=newJTextArea(5,30);
//创建流式分布对象
FlowLayoutlayout=newFlowLayout(FlowLayout.CENTER,0,10);
chatFrame.setLayout(layout);
//创建发送,关闭按扭
JButtonbutton_send=newJButton("发送");
JButtonbutton_close=newJButton("关闭");
//创建动作事件监听对象
ActionListeneraction_listener1=newActionListener()
{
publicvoidactionPerformed(ActionEvente){
area_record.setText(area_record.getText()+" "+area_input.getText());
area_input.setText("");
}
};
ActionListeneraction_listener2=newActionListener()
{
publicvoidactionPerformed(ActionEvente){
chatFrame.setVisible(false);
chatFrame.setDefaultCloseOperation(3);
}
};
//设置窗体可见
chatFrame.setVisible(true);
//添加按钮,事件监听对象
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);
}
}
复制代码
2.javamain方法调用
packageQQ2014;
publicclassTest{
publicstaticvoidmain(String[]args){
QQ2014qq=newQQ2014();
qq.showLoginFrame();
}
}

Ⅶ javaqq登陆是什么意思

第三方登录,就是你的系统可以用qq登录,技术上属于单点登录

热点内容
linux修改保存文件 发布:2024-05-19 17:30:38 浏览:665
网络有你脚本 发布:2024-05-19 17:29:55 浏览:769
黎明我的世界服务器 发布:2024-05-19 17:17:34 浏览:538
雷神g50如何设置安卓原生模式 发布:2024-05-19 16:50:04 浏览:120
c语言小数四舍五入 发布:2024-05-19 16:23:28 浏览:525
数据库被注入攻击 发布:2024-05-19 16:21:31 浏览:835
微信忘记密码从哪里看 发布:2024-05-19 16:06:37 浏览:33
宝马x4贷款买哪个配置好 发布:2024-05-19 15:56:03 浏览:23
微控pid算法 发布:2024-05-19 15:46:31 浏览:136
云盘视频解压密码 发布:2024-05-19 15:23:17 浏览:848