javaqq登录界面代码(用java制作qq登录界面,只要界面,不要事件处理)

2024-06-09 09:44:38 7

javaqq登录界面代码(用java制作qq登录界面,只要界面,不要事件处理)

本文目录

用java制作qq登录界面,只要界面,不要事件处理

package ibees.qq;import java.awt.BorderLayout;import java.net.URL;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;/** * 仿QQ登录界面,仅供学习参考,涉及到的有窗口居中、JPanel、LayoutManager的使用 * @author hhzxj2008 * */public class QQLoginView extends JFrame {/*** */private static final long serialVersionUID = -5665975170821790753L;public QQLoginView() {initComponent();} private void initComponent() {setTitle("用户登录");//设置LOGOURL image = QQLoginView.class.getClassLoader().getResource("ibees/qq/images/year.jpg");//图片的位置JLabel imageLogo = new JLabel(new ImageIcon(image));add(imageLogo,BorderLayout.NORTH); //QQ号和密码JPanel jp = new JPanel();JPanel jpAccount = new JPanel();jpAccount.add(new JLabel("帐号"));JTextField userTextField = new JTextField(15);jpAccount.add(userTextField);jpAccount.add(new JLabel("用户注册"));jp.add(jpAccount); JPanel jpPass = new JPanel();jpPass.add(new JLabel("密码"));JPasswordField passTextField = new JPasswordField(15);jpPass.add(passTextField);jpPass.add(new JLabel("找回密码"));jp.add(jpPass); //登录设置JPanel jpstatus = new JPanel();jpstatus.add(new JLabel("状态"));JComboBox statusComboBox = new JComboBox();statusComboBox.addItem("Q我");statusComboBox.addItem("在线");statusComboBox.addItem("隐身");statusComboBox.addItem("离线");jpstatus.add(statusComboBox);jpstatus.add(new JCheckBox("记住密码"));jpstatus.add(new JCheckBox("自动登录"));jp.add(jpstatus);add(jp); //底部登录按钮JPanel bottomPanel = new JPanel();bottomPanel.setLayout(new BorderLayout());bottomPanel.add(new JButton("设置"),BorderLayout.WEST);bottomPanel.add(new JButton("登录"),BorderLayout.EAST);add(bottomPanel,BorderLayout.SOUTH);setSize(324,230);setDefaultCloseOperation(EXIT_ON_CLOSE);setLocationRelativeTo(null);}/*** @param args*/public static void main(String args) {java.awt.EventQueue.invokeLater(new Runnable(){@Overridepublic void run() {new QQLoginView().setVisible(true); } }); }}

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

import java.awt.BorderLayout;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); cmb.addItem(s1); cmb.addItem(s1); 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界面的框架代码

我有个现成的你看看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 (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.equals("true")) { System.out.println("登陆成功!"); name = yanzheng; qq = yanzheng;// 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的,要求有用户名,密码,以及登录按钮,当登陆成功时,提示登陆成功!

主要代码 /** * 登录面板 */import java.awt.AWTException;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Frame;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.SystemTray;import java.awt.TrayIcon;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.io.File;import java.io.IOException;import java.sql.SQLException;import javax.imageio.ImageIO;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;public class Login{ private TrayIcon trayIcon;//托盘图标 private SystemTray systemTray;//系统托盘 public Login() { final JFrame myJFrame = new JFrame(" 登录"); myJFrame.setBounds(520, 200, 300, 250); myJFrame.setLayout(new BorderLayout()); myJFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /** * 实现系统托盘 */ systemTray = SystemTray.getSystemTray();//获得系统托盘的实例 try { trayIcon = new TrayIcon(ImageIO.read(new File("o.gif"))); systemTray.add(trayIcon);//设置托盘的图标,0.gif与该类文件同一目录 } catch (IOException e1) {e1.printStackTrace();} catch (AWTException e2) {e2.printStackTrace();} myJFrame.addWindowListener( new WindowAdapter(){ public void windowIconified(WindowEvent e){ myJFrame.dispose();//窗口最小化时dispose该窗口 } }); trayIcon.addMouseListener( new MouseAdapter(){ public void mouseClicked(MouseEvent e){ if(e.getClickCount() == 2)//双击托盘窗口再现 { myJFrame.setExtendedState(Frame.NORMAL); myJFrame.setVisible(true); } if(e.getClickCount() == 1) trayIcon.displayMessage("李", "", TrayIcon.MessageType.INFO); } public void mouseEntered(MouseEvent e){ trayIcon.displayMessage("a", "b", TrayIcon.MessageType.INFO); } }); //myJFrame.setIconImage(Toolkit.getDefaultToolkit().createImage(JFrame.class.getResource("images/topLogin.jpg"))); //显示图像 JLabel topLoginJLabel = new JLabel(new ImageIcon("images/topLogin.jpg")); JPanel topJPanel = new JPanel(); topJPanel.add(topLoginJLabel); topJPanel.setBackground(Color.black); myJFrame.add(topJPanel, BorderLayout.NORTH); final JPanel myJPanel = new JPanel(); myJFrame.setResizable(false); JLabel myJLabel1 = new JLabel("用户名:"); JLabel myJLabel2 = new JLabel("密码:"); JLabel myJLabel3 = new JLabel("验证码:"); final JTextField myJTextField1 = new JTextField(); final JPasswordField myJPasswordField1 = new JPasswordField(); final JTextField myJTextField3 = new JTextField(); //按钮 JButton myJButton1 = new JButton("确认"); JButton myJButton2 = new JButton("重置"); JButton myJButton3 = new JButton("注册"); //背景色 myJPanel.setBackground(Color.getHSBColor(212, 223, 23)); //设置面板布局 GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); myJPanel.setLayout(gridbag); MyLayout myLay = new MyLayout(); myLay.buildConstraints(constraints, 0, 0, 1, 1, 20, 35); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(myJLabel1, constraints); myLay.buildConstraints(constraints, 1, 0, 1, 1, 80, 0); constraints.fill = GridBagConstraints.HORIZONTAL; gridbag.setConstraints(myJTextField1, constraints); myLay.buildConstraints(constraints, 0, 1, 1, 1, 0, 25); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(myJLabel2, constraints); myLay.buildConstraints(constraints, 1, 1, 1, 1, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; gridbag.setConstraints(myJPasswordField1, constraints); myLay.buildConstraints(constraints, 0, 2, 1, 1, 33, 25); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(myJLabel3, constraints); myLay.buildConstraints(constraints, 1, 2, 1, 1, 33, 0); constraints.fill = GridBagConstraints.HORIZONTAL; gridbag.setConstraints(myJTextField3, constraints); myLay.buildConstraints(constraints, 2, 2, 1, 1, 34, 0); constraints.fill = GridBagConstraints.HORIZONTAL; @SuppressWarnings("unused") JudgeCode myJudgeCode = new JudgeCode(); gridbag.setConstraints(JudgeCode.judgeCodeLabel, constraints);//验证码 myLay.buildConstraints(constraints, 0, 3, 1, 1, 33, 15); constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; gridbag.setConstraints(myJButton1, constraints); myLay.buildConstraints(constraints, 1, 3, 1, 1, 33, 0); constraints.fill = GridBagConstraints.CENTER; gridbag.setConstraints(myJButton2, constraints); myLay.buildConstraints(constraints, 2, 3, 1, 1, 34, 0); constraints.fill = GridBagConstraints.NONE; gridbag.setConstraints(myJButton3, constraints);myJPanel.add(myJLabel1); myJPanel.add(myJTextField1); myJPanel.add(myJLabel2); myJPanel.add(myJPasswordField1); myJPanel.add(myJLabel3); myJPanel.add(myJTextField3); myJPanel.add(JudgeCode.judgeCodeLabel); myJPanel.add(myJButton1); myJPanel.add(myJButton2); myJPanel.add(myJButton3); myJFrame.add(myJPanel, BorderLayout.CENTER); //确认单击事件 myJButton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String username = new String(myJTextField1.getText()); //用户名 String mypassword = new String(myJPasswordField1.getPassword()); //获取密码 /** * 数据库操作 */ DataConn dataconn = new DataConn(); String sql = "select * from user_information where name = ’"+username+"’"; dataconn.executeQuery(sql); try { if(username == null || username == "" || mypassword == null || mypassword == "" || myJTextField3.getText() == null || myJTextField3.getText() == ""){ JOptionPane.showMessageDialog(null, "用户名、密码、验证码不能为空!请重新输入!"); } else if(!dataconn.rs.next()){ JOptionPane.showMessageDialog(null, "你输入的用户名不存在!请重新输入!"); myJTextField1.setText(""); myJPasswordField1.setText(""); } else if(!dataconn.rs.getString("password").equals(mypassword)) { JOptionPane.showMessageDialog(null, "你输入的密码错误!请重新输入!"); myJPasswordField1.setText(""); } else if(!myJTextField3.getText().equals(JudgeCode.code)){ JOptionPane.showMessageDialog(null, "你输入的验证码错误!请重新输入!"); } else { JOptionPane.showMessageDialog(null, "登录成功!"); @SuppressWarnings("unused") Index myIndex = new Index();//进入程序主界面 myJFrame.setVisible(false); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } dataconn.closeStmt(); dataconn.closeConn(); } }); //重置的单击事件 myJButton2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub myJTextField1.setText(""); myJPasswordField1.setText(""); } });//注册 myJButton3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub @SuppressWarnings("unused") Register myRegister = new Register(); } }); myJFrame.setVisible(true);//需要放在后面,不然得刷新才能显示页面 } public static void main(String args){ @SuppressWarnings("unused") Login myLogin = new Login(); }}

java QQ登陆界面代码

package com.demo4;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.GridLayout;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;import javax.swing.border.EmptyBorder;public class Demo1 extends JFrame{public Demo1(){init();}private void init(){ImageIcon icon=new ImageIcon("Image/8.jpg");setIconImage(icon.getImage());setTitle("QQ2011");setSize(310,270);setContentPane(createContentPane());}private JPanel createContentPane(){JPanel pane=new JPanel(new BorderLayout());pane.add(BorderLayout.NORTH,new JLabel(new ImageIcon("Image/5.jpg")));pane.add(BorderLayout.CENTER,createPane());pane.add(BorderLayout.SOUTH,createButtonPane());return pane;}private JPanel createPane(){JPanel pane=new JPanel(new BorderLayout());pane.setBorder(new EmptyBorder(12,24,12,24));pane.add(BorderLayout.NORTH,createGridPane());pane.add(BorderLayout.CENTER,createCheckBoxPane());return pane;}private JPanel createGridPane(){JPanel pane=new JPanel(new GridLayout(2,1,0,8));pane.add(createName());pane.add(createPassword());return pane;}private JPanel createName(){JPanel pane=new JPanel(new BorderLayout());pane.add(BorderLayout.WEST,new JLabel("账号"));pane.add(BorderLayout.CENTER,new JTextField(10));pane.add(BorderLayout.EAST,new JButton("清除账号"));return pane;}private JPanel createPassword(){JPanel pane=new JPanel(new BorderLayout());pane.add(BorderLayout.WEST,new JLabel("密码"));pane.add(BorderLayout.CENTER,new JPasswordField(10));pane.add(BorderLayout.EAST,new JButton("忘记密码"));return pane; } private JPanel createCheckBoxPane(){ JPanel pane=new JPanel(new FlowLayout()); JCheckBox jcb1=new JCheckBox("隐身登陆"); JCheckBox jcb2=new JCheckBox("记住密码"); pane.add(jcb1); pane.add(jcb2);return pane;}private JPanel createButtonPane(){JPanel pane=new JPanel(new FlowLayout());JButton denglu=new JButton("登陆");JButton quxiao=new JButton("取消");JComboBox jcbb=new JComboBox();Stringjc={"上线","隐身","离线","忙碌"};jcbb=new JComboBox(jc);pane.add(denglu);pane.add(quxiao);pane.add(jcbb);return pane;}public void ActionListener(){for(int i=0;i《=i;i++)System.out.println(i);} public void xianshi(){setVisible(true);}}下面是主函数的代码 估计包可能还有问题 还有图片的问题package com.demo4;public class Main1 {/** * @param args */public static void main(String args) {// TODO Auto-generated method stub Demo1 a=new Demo1(); a.xianshi();}}

JAVA用户怎么登录图形用户界面程序

  • 制作一个类似于QQ登陆的界面,以下数据库部分,你可以自己修该下,默认为Access;

  • import java.awt.*;

  • import javax.swing.*;

  • import java.awt.event.*;

  • import java.sql.*;

  • class JieMian extends JFrame;

  • {

  • JFrame f;

  • JLabel lb1;

  • JLabel lb2;

  • JTextField tf;

  • JPasswordField pwd;

  • JButton b1;

  • JButton b2;

  • JPanel p1;

  • JPanel p2;

  • Connection con;

  • Statement stmt;

  • String use;char passw;ResultSet rs;String k1,k2;public void init()f=new JFrame("登陆界面");init();b1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent ei){try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");con=DriverManager.getConnection("jdbc:odbc:dat");stmt=con.createStatement();use=tf.getText();passw=pwd.getPassword();String passww=new String(passw);rs=stmt.executeQuery("select * from user where 用户名=’"+use+"’ and  密码=’"+passww+"’");while(rs.next()){System.out.println(k1=rs.getString("用户名"));System.out.println(k2=rs.getString("密码"));}if(k1.equals(use)&&(k2.equals(passww))){JOptionPane.showMessageDialog(null,"用户登陆成功");//登陆成功}else{JOptionPane.showMessageDialog(null,"请检查用户信息,登陆失败");//登录失败}rs.close();stmt.close();con.close();}catch (Exception ey){JOptionPane.showMessageDialog(null,"请检查用户信息,登陆失败");}}});f.setLayout(new GridLayout(2,1,10,5));f.setVisible(true);f.setSize(210,150);f.setLocation(550,300);f.setResizable(false);f.setDefaultCloseOperation(EXIT_ON_CLOSE);b2.addActionListener(new ActionListener(){//58public void actionPerformed(ActionEvent e){f.setVisible(false);}});}}public class DengLu{public static void main(String args){new JieMian();}}。

请问用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; // 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登陆界面:  1.生成界面的java代码  package QQ2014;  import javax.swing.*;  import java.awt.*;  import java.awt.event.*;  public class QQ2014 {  //创建登陆界面类  public void showLoginFrame(){  //创建船体对象  JFrame loginFrame=new JFrame();  //设置大小,位置,标题  loginFrame.setSize(300,200);  loginFrame.setTitle("QQ2014");  loginFrame.setLocationRelativeTo(null);  //创建流式分布对象  FlowLayout layout=new FlowLayout();  loginFrame.setLayout(layout);  //创建账户名,密码和输入框  JLabel user_name=new JLabel("账号:");  JLabel user_password=new JLabel("密码:");  JTextField field_name=new JTextField(20);  JPasswordField field_password=new JPasswordField(20);  //创建登陆,重置按钮  JButton button_reset=new JButton("重置");  JButton button_login=new JButton("登陆");  //设置窗体可见  loginFrame.setVisible(true);  //创建事件监听对象  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("");  }  };  //将文本输入框,按钮,事件监听对象添加  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(){  //创建窗体对象  JFrame indexFrame=new JFrame();  indexFrame.setSize(200,500);  indexFrame.setTitle("QQ好友列表");  indexFrame.setLocationRelativeTo(null);  //设置流式分布对象  FlowLayout layout=new FlowLayout(FlowLayout.CENTER,100,10);  indexFrame.setLayout(layout);  //创建好友按钮  for(int i=0;i《10;i++)  {  JButton button_friend=new JButton("friend"+i);  //创建动作事件监听对象  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);  }  //设置窗体可见  indexFrame.setVisible(true);  }  public void showChatFrame(){  //创建窗体,大小,位置,标题  JFrame chatFrame=new JFrame();  chatFrame.setSize(400,400);  chatFrame.setTitle("正在聊天中...");  chatFrame.setLocationRelativeTo(null);  //创建聊天记录,输入域  JTextArea area_input=new JTextArea(10,30);  JTextArea area_record=new JTextArea(5,30);  //创建流式分布对象  FlowLayout layout=new FlowLayout(FlowLayout.CENTER,0,10);  chatFrame.setLayout(layout);  //创建发送,关闭按扭  JButton button_send=new JButton("发送");  JButton button_close=new JButton("关闭");  //创建动作事件监听对象  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);  }  };  //设置窗体可见  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.java main方法调用  package QQ2014;  public class Test {  public static void main(String args){  QQ2014 qq=new QQ2014();  qq.showLoginFrame();  }  }

javaqq登录界面代码(用java制作qq登录界面,只要界面,不要事件处理)

本文编辑:admin

更多文章:


神舟电脑官方网站(神舟电脑官方网站用户注册)

神舟电脑官方网站(神舟电脑官方网站用户注册)

神舟电脑官方网站用户注册好的,关于“神舟电脑官方网站用户注册”的相关内容,条理清晰的解释如下:一、用户注册的必要性1. 访问神舟电脑官方网站的用户可以通过注册成为会员,享受更多服务和优惠。2. 注册账户有助于用户管理自己的订单、产品信息和个

2024年7月18日 12:26

神舟笔记本官网(神舟笔记本官网首页)

神舟笔记本官网(神舟笔记本官网首页)

神舟笔记本官网首页“神舟笔记本官网首页”是神舟电脑股份有限公司的官方网站主页,以下是关于该网站的一些相关内容解释:1. 首页设计: - 通常,神舟笔记本官网首页的设计会非常简洁明了,以便用户快速找到所需信息。 - 页面布局通常包括公

2024年7月10日 17:21

联想f41(联想F41A)

联想f41(联想F41A)

联想F41A“联想F41A”是联想公司推出的一款笔记本电脑型号。以下是与该型号有关的一些相关内容:1. 概述: * 联想F41A笔记本电脑是联想品牌旗下的一个产品系列,其定位可能为商用或家庭娱乐使用。 * 该系列笔记本电脑具备基本的工作

2024年7月25日 07:26

hp870(hp8704主板)

hp870(hp8704主板)

hp8704主板HP 8704主板是一款企业级服务器主板,其详细内容可以包括以下几个方面:1. 主板芯片组:主板上搭载的芯片组决定了其支持的处理器类型、内存容量和扩展性等关键特性。HP 8704主板的芯片组根据具体型号有所不同,但通常都是为

2024年7月27日 13:31

联想y550p(联想y550配置参数)

联想y550p(联想y550配置参数)

联想y550配置参数联想Y550是一款较为老旧的笔记本电脑型号,但它的配置参数在当时是比较出色的。以下是关于联想Y550的配置参数的详细解释:一、处理器联想Y550通常搭载的是英特尔的酷睿i系列处理器,如i5或i7等。这些处理器具有较高的主

2024年7月9日 15:45

惠普cq43(惠普cq43笔记本参数)

惠普cq43(惠普cq43笔记本参数)

惠普cq43笔记本参数惠普CQ43笔记本是一款中端商务笔记本电脑,以下是关于其参数的详细解释:1. 处理器: - CQ43笔记本的处理器可能采用英特尔的酷睿i系列(如i3、i5、i7等),具体型号因产品不同而异。 - 处理器是电脑的

2024年7月12日 22:39

华硕k50ie(华硕K50IE)

华硕k50ie(华硕K50IE)

华硕K50IE华硕K50IE是一款笔记本电脑,以下是与它相关的内容解释:1. 型号与定位: * “K50IE”是华硕(ASUS)的一款电脑型号,代表着它的设计和规格。 * 这款电脑可能针对的是那些需要性能和功能但预算相对适中的消费者,通

2024年7月7日 10:06

联想台式机推荐(联想台式机推荐联想扬天)

联想台式机推荐(联想台式机推荐联想扬天)

联想台式机推荐联想扬天关于“联想台式机推荐联想扬天”的相关内容,以下是一些条理明确的解释:1. 联想品牌介绍:联想是一家全球知名的电子产品制造公司,主要生产电脑、手机等电子产品。其台式机产品线涵盖了家用、商用以及特定行业使用等多种场景。2.

2024年7月7日 13:42

联想万全(联想万全R520)

联想万全(联想万全R520)

联想万全R520联想万全R520是一款服务器产品,它主要被设计用于满足各种行业的应用需求。下面,我会为你条理清晰地解释关于“联想万全R520”的相关内容:一、产品概述联想万全R520是一款企业级服务器,该产品凭借其卓越的性能和稳定的质量,广

2024年7月28日 13:46

联想y560(联想y560键盘怎么拆)

联想y560(联想y560键盘怎么拆)

联想y560键盘怎么拆联想Y560键盘的拆卸步骤如下:1. 准备工具:螺丝刀、小铲子等工具,以便将螺丝和卡扣松开。2. 拆下所有可移动的部件:包括底部的电池和内存卡等,以确保在拆解过程中不会造成损害。3. 移除所有固定螺丝:在键盘的四周通常

2024年7月28日 22:56

惠普笔记本电脑怎样(惠普笔记本电脑怎样关机)

惠普笔记本电脑怎样(惠普笔记本电脑怎样关机)

惠普笔记本电脑怎样关机关于“惠普笔记本电脑怎样关机”的条理明确的解释如下:1. 确认保存工作:在关机之前,请确保你已经保存了所有未保存的工作。如果正在使用文档、电子表格或任何其他文件,请确保它们已保存到相应的位置。2. 点击开始菜单:在电脑

2024年7月20日 05:21

商务电脑(商务电脑有什么特别之处)

商务电脑(商务电脑有什么特别之处)

商务电脑有什么特别之处商务电脑与普通电脑相比,具有一些特别之处,主要表现在以下几个方面:1. 性能稳定:商务电脑通常更注重稳定性,能够满足长时间连续运行的要求。商务用户常常需要运行多个应用和进行复杂计算,这要求电脑在复杂计算、文件处理、图表

2024年7月14日 00:24

dell curry(Dell curry怎么读)

dell curry(Dell curry怎么读)

Dell curry怎么读“Dell Curry”是一个英文名字,以下是关于“Dell curry怎么读”的条理明确的解释:1. 分段读法:将名字分成“Dell”和“Curry”两部分来读。 - “Dell”:这个音节读作 /del/,

2024年7月21日 11:55

天逸f50(天逸F50A)

天逸f50(天逸F50A)

天逸F50A“天逸F50A”是一款电子产品,通常是一款笔记本电脑。以下是一些关于“天逸F50A”的相关内容:1. 产品概述:天逸F50A是联想(Lenovo)公司推出的一款笔记本电脑。2. 硬件配置:具体的硬件配置可能因型号和版本而异,但一

2024年7月27日 06:50

显卡加速器(显卡加速器怎么打开)

显卡加速器(显卡加速器怎么打开)

显卡加速器怎么打开“显卡加速器”通常指的是一种能够提升图形处理性能、优化游戏体验的技术或工具。然而,具体如何打开显卡加速器,这取决于你使用的具体产品或软件。以下是一些可能的步骤和注意事项:1. 确认显卡型号和驱动程序: - 首先,你需要

2024年7月18日 09:06

笔记本内存报价(笔记本内存报价怎么看)

笔记本内存报价(笔记本内存报价怎么看)

笔记本内存报价怎么看关于“笔记本内存报价怎么看”的相关内容,条理明确的解释如下:一、了解基本概念1. 内存类型:首先要了解的是笔记本内存的常见类型,如DDR4、DDR3等。不同的类型其价格也会有所不同。2. 内存容量:内存的容量大小(如4G

2024年7月19日 04:22

华硕x502(华硕x502ca)

华硕x502(华硕x502ca)

华硕x502ca华硕X502CA是一款笔记本电脑,以下是关于它的相关内容解释:1. 硬件配置: - 处理器:该电脑搭载的处理器类型和具体型号会影响其性能。 - 内存:内存大小决定了电脑可以同时处理的任务量,华硕X502CA配备了足够

2024年7月14日 04:00

笔记本导购(笔记本导购推荐)

笔记本导购(笔记本导购推荐)

笔记本导购推荐关于“笔记本导购推荐”的相关内容,主要涉及到在购买笔记本时需要注意的各个方面。以下是详细的解释:一、需求分析在开始导购推荐之前,首先要进行需求分析。这包括确定购买者的使用场景、预算、品牌偏好以及具体需求等。例如,是用于办公、学

2024年7月10日 20:51

联想乐phone(联想乐phone3GW100)

联想乐phone(联想乐phone3GW100)

联想乐phone3GW100联想乐Phone 3GW100是一款由联想公司推出的智能手机。以下是关于该手机的一些相关内容:1. 硬件配置:联想乐Phone 3GW100通常搭载了较为先进的处理器,提供了流畅的操作体验。同时,该手机配备了较大

2024年7月22日 12:04

6520s(6520是什么意思)

6520s(6520是什么意思)

6520是什么意思“6520是什么意思”可能会因上下文不同而具有不同的含义。由于这个词汇不是一个公认的缩写、术语或者习惯用法,其确切意义需要具体情境来确定。不过,在一些情境下,它可能只是一个随机的数字组合,没有特别的含义。如果想了解更多关于

2024年7月28日 15:05

近期文章

本站热文

iphone vpn设置(ios设置vpn快捷开关)
2024-07-22 15:01:12 浏览:2334
windows12正式版下载(操作系统Windows Server 2012 R2,在哪能下载到,公司用的)
2024-07-20 17:26:53 浏览:1730
java安装教程(win10如何安装JAVA)
2024-07-19 19:55:49 浏览:1155
client mfc application未响应(每次进cf就提示client MFC Application未响应该怎么办啊!急急急)
2024-07-20 11:15:58 浏览:1152
标签列表

热门搜索