网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

qq登录页面java代码,java调用登录

求QQ登陆界面的Java GUI(图形用户界面开发)代码!

import java.awt.BorderLayout;

成都创新互联公司是一家专业提供新城企业网站建设,专注与成都网站设计、做网站H5开发、小程序制作等业务。10年已为新城众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Toolkit;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

public class Demo extends JFrame{

Container contentPane;

ImageIcon img = new ImageIcon("002.jpg");

JPanel paneTop = new JPanel();

JPanel paneMid = new JPanel();

JPanel paneBut = new JPanel();

JPanel paneAll = new JPanel();

JLabel lblTop = new JLabel();

JLabel lblName = new JLabel();

JLabel lblPwd = new JLabel();

JLabel lblApply = new JLabel();

JLabel lblForget = new JLabel();

JLabel lblModel = new JLabel();

JLabel lblNull = new JLabel();

JTextField txtName = new JTextField(15);

JPasswordField txtPwd = new JPasswordField(15);

JComboBox cmb = new JComboBox();

JCheckBox chk = new JCheckBox();

JButton btnKill = new JButton("查杀木马");

JButton btnSet = new JButton("设置");

JButton btnLogin = new JButton("登录");

Demo(){

lblTop.setIcon(img);

paneTop.add(lblTop);

lblName.setText("QQ帐号:");

lblApply.setText("申请帐号 ");

lblPwd.setText("QQ密码:");

lblForget.setText("忘记密码?");

lblModel.setText("状态:");

String[] s1 = {"隐身","在线","忙碌"};

cmb.addItem(s1[0]);

cmb.addItem(s1[1]);

cmb.addItem(s1[2]);

chk.setText("自动登录");

paneMid.add(lblName);

paneMid.add(txtName);

paneMid.add(lblApply);

paneMid.add(lblPwd);

paneMid.add(txtPwd);

paneMid.add(lblForget);

paneMid.add(lblModel);

paneMid.add(cmb);

paneMid.add(chk);

paneBut.add(btnKill);

paneBut.add(btnSet);

paneBut.add(btnLogin);

contentPane = this.getContentPane();

contentPane.add(paneTop,BorderLayout.NORTH);

contentPane.add(paneMid,BorderLayout.CENTER);

contentPane.add(paneBut,BorderLayout.SOUTH);

setTitle("欢迎使用QQ");

setSize(330,240);

Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

setLocation((screen.width - getSize().width)/2,(screen.height - getSize().height)/2 );

setVisible(true);

setResizable(false);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public static void main(String args[]){

Demo d = new Demo();

}

}

怎么用JAVA做QQ登陆界面的密码框

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class QQLogin extends JFrame {

JTextField jtf,jtf1;

public QQLogin() {

jtf = new JTextField(12);

jtf.setText("请输入");

jtf.setForeground(Color.GRAY);// 设置颜色

JPanel jp = new JPanel();

jp.add(jtf);

jtf1 = new JTextField(12);

JPanel jp1 = new JPanel();

jp1.add(jtf1);

this.add(jp1, BorderLayout.NORTH);

this.add(jp,BorderLayout.SOUTH);

this.setTitle("密码输入提示");

this.setBounds(300, 200, 220, 160);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.setVisible(true);

//jp1.getComponents()[0].setBackground(Color.RED);

//jp1上可能添加了很多组件,于是可以使用getComponents()返回一个组件数组。

//[0]表示选取该组件数组的第一个组件

//setBackground(Color.RED) 表示把该组件变成红色的背景颜色

jtf.addFocusListener(new FocusListener() {

@Override

public void focusLost(FocusEvent e) {// 失去焦点的时候

// 如果内容为空,设置文本

if (jtf.getText().trim().equals("")) {

jtf.setText("请输入");

}

}

@Override

public void focusGained(FocusEvent e) {// 得到焦点的时候

if (jtf.getText().trim().equals("请输入")) {

jtf.setText("");// 让文本为空白

}

}

});

}

public static void main(String[] args) {

new QQLogin();

}

}

代码上已经回答了你的2个问题

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

package ch10;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

//定义该类继承自JFrame,实现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("登陆成功,欢迎您的到来!");

}

else

{

jl[2].setText("对不起,您的用户名或密码错误!");

}

}

}

public static void main(String[] args)

{

//创建LoginTest窗体对象

new LoginTest();

}

}

这个简单点的

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

太简单了!你看看! 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){//以下动作将在事件调度线程中运行,十分安全 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登录界面的写法如下:

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;i2;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();

}

}

用Java编 QQ登录界面

是javeSE。主要用来编写一些界面程序,带窗口的。

ME是专门用来手机开发的。不过前途不咋滴了。

EE是用来进行企业级开发的。多少是BS编程,就是网站类程序。

这3个的基本的java基础类都是一样 的。

区别是:

SE含有SWing等界面类。

ME有很多对手机硬件操作的类。

EE有很多WEB开发的类。

希望对你有所帮助!o(∩_∩)o 哈哈


网页标题:qq登录页面java代码,java调用登录
文章URL:http://bjjierui.cn/article/hsjopd.html

其他资讯