eclipse java 中qq登录,QQ的登陆页面 java编程,该如何处理

这篇博客介绍了如何使用Java Swing库创建一个简单的QQ登录界面,包括输入用户名、密码的文本框,以及登录按钮。博主遇到了在'自动登录'和'记住密码'选项上实现勾选功能的问题,并对下拉菜单的实现感到困惑。博客中提供了部分代码示例,但未完成复选框和下拉菜单的实现。
摘要由CSDN通过智能技术生成

当前位置:我的异常网» Eclipse » QQ的登陆页面 java编程,该如何处理

QQ的登陆页面 java编程,该如何处理

www.myexceptions.net  网友分享于:2013-04-20  浏览:101次

QQ的登陆页面 java编程

简单的做了一下QQ的登陆界面 我先知道怎么在那个“自动登录” “记住密码” 前面的小方块里点一下就加上对号 不对就不进行操作 还有就是QQ界面上的隐身 在线 忙碌 下拉菜单怎么弄 求高人指点啊 。。。急急急!!!明天就要交作业啊。。。。。

图片如下:

[code=Java][/code]

package QQ;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.FocusAdapter;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

public class LoginQQ extends JFrame implements ActionListener{

private JTextField name;

private JPasswordField passwordField;

private JTextField password;

public LoginQQ(){

this.setLayout(null);

JLabel image = new JLabel(new ImageIcon("image\\QQLogin2012.jpg"));

image.setBounds(0,-28,378,280);

this.add(image);

JTextField name = new JTextField(23);

name.setBounds(110, 115, 165,26);

this.add(name);

JPasswordField password = new JPasswordField(16);

password.setBounds(110, 148, 165, 26);

this.add(password);

//注册账号:

JButton login = new JButton(new ImageIcon("image\\QQ1.jpg"));

login.setBounds(308, 119, 56, 16);

this.add(login);

login.addActionListener(this);

//找回密码:

JButton getword = new JButton(new ImageIcon("image\\QQ2.jpg"));

getword.setBounds(308, 153, 56, 16);

this.add(getword);

getword.addActionListener(this);

//记住密码:

JTextField a = new JTextField(4);

a.setBounds(156, 186, 14,14);

this.add(a);

//记住密码:

JTextField b = new JTextField(4);

b.setBounds(236, 186, 14,14);

this.add(b);

//登陆:

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

landing.setBounds(300,220 ,70 ,24);

this.add(landing);

landing.addActionListener(this);

//设置:

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

set.setBounds(80, 220, 70, 24);

this.add(set);

set.addActionListener(this);

//多账号登陆:

JButton accunt = new JButton("多账号");

accunt.setBounds(4, 220, 75, 24);

this.add(accunt);

accunt.addActionListener(this);

initJFrame();

}

private void initJFrame() {

this.setLocation(100, 100);

this.setSize(378, 279);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

this.setResizable(false);

this.setIconImage(new ImageIcon("image\\QQ4.jpg").getImage());

this.setVisible(true);

}

public static void main(String[] args) {

new LoginQQ();

}

@Override

public void actionPerformed(ActionEvent e) {

String username = name.getText();

if(e.getActionCommand().equals("登陆")){

String password = new String(passwordField.getPassword());

if(username.trim().equals("123456789") && new String (passwordField.getPassword()).trim().equals("123456789")){

System.out.println("登陆成功");

}else{

System.out.println("登陆超时");

}

}else if(e.getActionCommand().equals("注册账号")){

name.setText("");

passwordField.setText("");

}

}

}

------解决方案--------------------

import javax.swing.JCheckBox;

import javax.swing.JComboBox;

import javax.swing.JFrame;

public class a extends JFrame{

public a(){

this.setLayout(null);

into();

this.setSize(378, 279);

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

this.setLocationRelativeTo(null);

this.setVisible(true);

}

public void into(){

//复选框

JCheckBox jeb = new JCheckBox("记住密码");

jeb.setBounds(10, 100, 80, 20);

文章评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值