當前位置:編程學習大全網 - 圖片素材 - 用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("用戶登錄");

//設置LOGO

URL 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(){

@Override

public void run() {

new QQLoginView().setVisible(true);

}

});

}

}

  • 上一篇:海清主演的電視劇全部
  • 下一篇:高唐賦的作品鑒賞壹
  • copyright 2024編程學習大全網