高级语言案例分析_QQ_登录
2013-07-30 12:29
316 查看
package javaQQ; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; 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; import com.sun.org.apache.bcel.internal.generic.NEW; public class Load_QQ extends JFrame { User_QQ userQQ=new User_QQ(); static String un; boolean Flag=false; private JLabel welcomela=null; private JLabel servela=null; private JLabel userla=null; private JLabel passwordla=null; private JTextField servejt=null; private JTextField userjt=null; private JPasswordField passwordjp=null; private JButton loadbtn=null; private JButton canclebtn=null; private JButton loginbtn=null; private JPanel inputJp=null; private JPanel btnJp=null; public Load_QQ(){ super("用户登陆"); init(); } public void init(){ inputJp=new JPanel(); btnJp=new JPanel(); this.setLayout(new FlowLayout()); inputJp.setLayout(new GridLayout(3,2)); welcomela=new JLabel("欢迎使用javaQQ"); servela=new JLabel("服务器:"); userla=new JLabel("用户名:"); passwordla=new JLabel("密 码:"); servejt=new JTextField("shenzhaowei_QQ"); userjt=new JTextField(10); passwordjp=new JPasswordField(10); loadbtn=new JButton("登陆"); canclebtn=new JButton("取消"); loginbtn=new JButton("注册"); inputJp.add(servela); inputJp.add(servejt); inputJp.add(userla); inputJp.add(userjt); inputJp.add(passwordla); inputJp.add(passwordjp); btnJp.add(loadbtn); btnJp.add(canclebtn); btnJp.add(loginbtn); this.add(welcomela); this.add(inputJp); this.add(btnJp); this.setSize(260,260); this.setVisible(true); this.show(); loadbtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String serveName=servejt.getText().trim(); String userName=userjt.getText().trim(); String passwordStr=passwordjp.getText().trim(); int i; for(i=0;i<userQQ.userpasswordU.length;i++){ System.out.println("userpasswordU:"+userQQ.userpasswordU[i]); System.out.println("passwordStr:"+passwordStr); if(userQQ.usernameU[i].equals(userName)){ System.out.println("usernameU:"+userQQ.usernameU[i]); System.out.println("userName:"+userName); un=userQQ.usernameU[i]; if(userQQ.userpasswordU[i].equals(passwordStr)){ System.out.println("userpasswordU:"+userQQ.userpasswordU[i]); System.out.println("passwordStr:"+passwordStr); Flag=true; break; } } } System.out.println(Flag); System.out.print("un:"+un); if(Flag==true){ close(); Friend_QQ friendQQ=new Friend_QQ(un); } } }); loginbtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ Login_QQ lg=new Login_QQ(); close(); } }); this.setDefaultCloseOperation(EXIT_ON_CLOSE); canclebtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.exit(0); } }); } public void close(){ this.dispose(); } public static void main(String args[]){ Load_QQ ld=new Load_QQ(); } }
相关文章推荐
- 高级语言案例分析_QQ_注册
- 高级语言案例分析_QQ_好友
- 高级语言案例分析_QQ_聊天
- 高级语言案例分析_QQ_数据库操作
- 高级语言案例分析_文本编辑器
- 基于visual c++之windows核心编程代码分析(62)读取本地已登录的QQ号及应用代码
- QQ登录协议分析图
- Android(java)学习笔记209:采用get请求提交数据到服务器(qq登录案例)
- Android(java)学习笔记213:开源框架post和get方式提交数据(qq登录案例)
- 线程高级应用-心得1-传统线程和定时器讲解及案例分析
- 高级需求分析技巧,用案例说明,如何从运行场景中挖掘功能需求?
- 基于第三方QQ授权登录和新浪微博授权登录的iOS代码分析
- 案例分析Java语言中try-catch-finally过程
- 线程高级应用-心得2-同步锁讲解及面试题案例分析
- 高级需求分析技巧,用案例说明,如何从运行场景中挖掘功能需求?
- 高级语言的一段汇编代码分析
- 分析网站如何检测已经登录的QQ帐号
- 用户注册登录案例分析以及简单实现
- 线程高级应用-心得3-线程范围内的共享变量以及应用场景及面试题案例分析
- Spring Security源码分析三:Spring Social实现QQ社交登录