qqjava代码 代码大全

QQ客户端Java代码 问题 懂得进来看看吧 完全看不懂 求详细注释new Thread(){
public void run(){
while(true){
实例一个线程
try {
ObjectInputStream ois=
new ObjectInputStream(
s.getInputStream());
打开流通道 接收信息
if("login".equals(type)){
ListString users=msg.getUserList();
if(dlm.getSize()==0){
for(int i=0;iusers.size();i){
dlm.addElement(users.get(i));
}
如果type为‘login’qqjava代码的话获取msg中的userlist()
Object obj=ois.readObject();
Message msg=(Message)obj;
String type=msg.getType();
把接收的信息转成message类型 获取msg中的type信息
System.out.println("hhhh");
debug用无意义
if("login".equals(type)){
ListString users=msg.getUserList();
if(dlm.getSize()==0){
for(int i=0;iusers.size();i){
dlm.addElement(users.get(i));
}
如果type为“login”拿就获取msg中的userlist() 如果dlm中信息量为0 则把userlist()内信息赋给dlm
}else{
dlm.addElement(msg.getFromUser());
}
否则dlm增加信息为msg中的formuser()qqjava代码;
String oldMes=showMessage.getText();
String newMes=msg.getSendContent();
if(oldMes==null||"".equals(oldMes)){
showMessage.setText(newMes);
}else{
String allMes=oldMes "\n" newMes;
showMessage.setText(allMes);
}
获取原始信息 新增信息 若原始信息为空则显示新信息 否则显示原始信息换行新信息
else if("logout".equals(type)){
String name2=msg.getFromUser();
if(name2.equals(name)){
dlm.removeAllElements();
}else{
dlm.removeAllElements();
ListString users=msg.getUserList();
for(int i=0;iusers.size();i){
dlm.addElement(users.get(i));
}
}
如果type==“logout” 如果下线的用户是自己则删除dlm所有信息 如果不是自己则dlm删除后重新获取userlist()
下面的都被注释掉qqjava代码了
用java实现QQ登录界面怎么写package ch10;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//定义该类继承自JFrameqqjava代码,实现ActionListener接口
public class LoginTest extends JFrame implements ActionListener
{
//创建JPanel对象
private JPanel jp=new JPanel();
//创建3个标并加入数组
JLabel name = new JLabel("请输入用户名");
JLabel password = new JLabel("请输入密码");
JLabel show = new JLabel("");
private JLabel[] jl={name,password,show};
//创建登陆和重置按扭并加入数组
JButton login = new JButton("登陆");
JButton reset = new JButton("重置");
private JButton[] jb={login,reset};
//创建文本框以及密码框
private JTextField jName=new JTextField();
private JPasswordField jPassword =new JPasswordField();
public LoginTest()
{
//设置布局管理器为空布局 , 这里自己摆放按钮、标签和文本框
jp.setLayout(null);
for(int i=0;i2;i)
{
//设置标签和按扭的位置与大小
jl[i].setBounds(30,20 40*i,180,20);
jb[i].setBounds(30 110*i,100,80,20);
//添加标签和按扭到JPanel容器中
jp.add(jl[i]);
jp.add(jb[i]);
//为2个按钮注册动作事件监听器
jb[i].addActionListener(this);
}
//设置文本框的位置和大?。⒁饴忝拦鄄⒆愎挥没某ざ?
jName.setBounds(130,15,100,20);
//添加文本框到JPanel容器中
jp.add(jName);
//为文本框注册动作事件监听器
jName.addActionListener(this);
//设置密码框的位置和大?。⒁饴忝拦酆妥愎幻苈氲某ざ?
jPassword.setBounds(130,60,100,20);
//添加密码框到JPanel容器中
jp.add(jPassword);
//设置密码框中的回显字符,这里设置美元符号
jPassword.setEchoChar('$');
//为密码框注册动作事件监听器
jPassword.addActionListener(this);
//设置用于显示登陆状态的标签大小位置,并将其添加进JPanel容器
jl[2].setBounds(10,180,270,20);
jp.add(jl[2]);
//添加JPanel容器到窗体中
this.add(jp);
//设置窗体的标题、位置、大小、可见性及关闭动作
this.setTitle("登陆窗口");
this.setBounds(200,200,270,250);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
//实现动作监听器接口中的方法actionPerformed
public void actionPerformed(ActionEvent e)
{
//如果事件源为文本框
if(e.getSource()==jName)
{
//切换输入焦点到密码框
jPassword.requestFocus();
}
//如果事件源为重置按扭
else if(e.getSource()==jb[1])
{
//清空姓名文本框、密码框和show标签中的所有信息
jl[2].setText("");
jName.setText("");
jPassword.setText("");
//让输入焦点回到文本框
jName.requestFocus();
}
//如果事件源为登陆按钮 , 则判断登录名和密码是否正确
else
{
//判断用户名和密码是否匹配
if(jName.getText().equals("lixiangguo")
String.valueOf(jPassword.getPassword()).equals("19801001"))
{
jl[2].setText("登陆成功,欢迎您的到来qqjava代码!");
}
else
{
jl[2].setText("对不起,您的用户名或密码错误!");
}
}
}
public static void main(String[] args)
{
//创建LoginTest窗体对象
new LoginTest();
}
}
这个简单点的
如何使用Java发送qq邮件方法:
1.前提准备工作:
首先 , 邮件的发送方要开启POP3 和SMTP服务--即发送qq邮件的账号要开启POP3 和SMTP服务
2.开启方法:
登陆qq邮箱
3.点击设置
4.点击—-账户
5.找到:POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务 —点击开启
6.送短信 —–点击确定
7.稍等一会,很得到一个授权码! –注意:这个一定要记住 , 一会用到
8.点击保存修改 —OK 完成
9.java 测试代码:
package cn.cupcat.test;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
public class SendmailUtil {
public static void main(String[] args) throws AddressException,MessagingException {
Properties properties = new Properties();
properties.put("mail.transport.protocol", "smtp");// 连接协议
properties.put("mail.smtp.host", "smtp.qq.com");// 主机名
properties.put("mail.smtp.port", 465);// 端口号
properties.put("mail.smtp.auth", "true");
properties.put("mail.smtp.ssl.enable", "true");//设置是否使用ssl安全连接---一般都使用
properties.put("mail.debug", "true");//设置是否显示debug信息true 会在控制台显示相关信息
//得到回话对象
Session session = Session.getInstance(properties);
// 获取邮件对象
Message message = new MimeMessage(session);
//设置发件人邮箱地址
message.setFrom(new InternetAddress("123456789@qq.com"));
//设置收件人地址message.setRecipients(RecipientType.TO,new InternetAddress[] { new InternetAddress("987654321@qq.com") });
//设置邮件标题
message.setSubject("这是第一封Java邮件");
//设置邮件内容
message.setText("内容为: 这是第一封java发送来的邮件 。");
//得到邮差对象
Transport transport = session.getTransport();
//连接自己的邮箱账户
transport.connect("123456789@qq.com", "vvctybgbvvophjcj");//密码为刚才得到的授权码
//发送邮件transport.sendMessage(message, message.getAllRecipients());
}
}
10.运行就会发出邮件了 。。。。
下面是我收到邮件的截图,当然我把源码中的邮件地址都是修改了,不是真实的,你们测试的时候,可以修改能你们自己的邮箱 。最后,祝你也能成功,如果有什么问题,可以一起讨论!
注意事项
得到的授权码一定要保存好,程序中要使用
请问用java程序模拟qq登录界面的代码怎么写?。?/h2>太简单了qqjava代码!qqjava代码你看看qqjava代码! package dyno.swing.beans.qq; import javax.swing.*; import javax.swing.event.MouseInputListener; import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel; /*import org.jvnet.substance.skin.SubstanceModerateLookAndFeel; import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;*/ 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,shezhi,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 (UnsupportedLookAndFeelException 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);//设置进度栏qqjava代码的最大值 activity=new SimThread(1000); activity.start();//启动线程 activityMonitor.start();//启动定时器 chashamuma.setEnabled(false);//禁止按钮 } }); activityMonitor=new Timer(100,new ActionListener(){//每0.5秒执行一次 public void actionPerformed(ActionEvent e){//以下动作将在事件调度线程中运行qqjava代码,十分安全 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("baijiantou.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.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel()) ; UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel");} 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 (currenttarget!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(); } }
用JAVA怎么写QQ用java是可以写出qq的 , 只不过用java开发c/s的软件不是java特长的,你要是真的想写 , 就写着练练手吧,最起码可以巩固java se上的知识 。
具体怎么写,给你个大概的思路吧,因为我没办法在这个有限的输入框内把所有的代码写完 。
【1】先写出qq的简单界面
【2】给每个按钮添加监听
【3】按钮事件(方法)定义
【4】连接网络(socket)
【5】测试
【5】其他功能添加
【6】测试
JAVA 用代码实现登入QQ空间操作辽主临轩qqjava代码的分享
分享
java程序模拟qq登录界面的代码
java程序如何实现登录、记住密码、自动登录等功能qqjava代码!
package dyno.swing.beans.qq;
import javax.swing.*;
import javax.swing.event.MouseInputListener;
import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;
/*import org.jvnet.substance.skin.SubstanceModerateLookAndFeel;
import org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel;*/
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,shezhi,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 (UnsupportedLookAndFeelException 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){//以下动作将在事件调度线程中运行qqjava代码,十分安全
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("baijiantou.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.setDefaultLookAndFeelDecorated(true);
try {
UIManager.setLookAndFeel(new SubstanceOfficeBlue2007LookAndFeel()) ;
UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel");
} 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 (currenttarget!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();
}
}
【qqjava代码 代码大全】qqjava代码的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于代码大全、qqjava代码的信息别忘了在本站进行查找喔 。

    推荐阅读