当前位置: 代码迷 >> Eclipse >> QQ的登陆页面 java编程,该如何处理
  详细解决方案

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

热度:99   发布时间:2016-04-23 13:34:28.0
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);
  相关解决方案