2016/04/20

package com.wode.test;

import java.awt.Container;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

public class Student extends JFrame{

 public Student(String title){
  super(title);
  Container c=this.getContentPane();
  this.setSize(400, 300);
  this.setLocationRelativeTo(null);
  this.setLayout(null);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setResizable(false);
  JLabel jLabelName = new JLabel("用户名:");
  JLabel jLabelpassword = new JLabel("密码:");
  JPanel jPanel = new JPanel();  
  jPanel.setLayout(null);  
  jPanel.setBounds(1, 1, 400, 300);
  jLabelName.setBounds(100, 65, 60, 20);
  jLabelpassword.setBounds(100, 120, 60, 20);
  jPanel.add(jLabelpassword);
  jPanel.add(jLabelName);
  JTextField txtName = new JTextField();
  txtName.setBounds(180, 65, 85, 20);
  jPanel.add(txtName);
  JPasswordField txtpassword = new JPasswordField();
  txtpassword.setBounds(180, 120, 85, 20);
  jPanel.add(txtpassword);
  JButton okbtn=new JButton("确定");
  okbtn.setBounds(110, 200, 60, 40);
  jPanel.add(okbtn);
  JButton cancelbtn=new JButton("取消");
  cancelbtn.setBounds(220, 200, 60, 40);
  jPanel.add(cancelbtn);
  JRadioButton supervise = new JRadioButton("管理登陆");
  supervise.setBounds(100,25, 120, 20);
  jPanel.add(supervise);
  JRadioButton studnet = new JRadioButton("学生登陆");
  studnet.setBounds(220,25, 120, 20);
  jPanel.add(studnet);
  JLabel newName = new JLabel("注册账号");
  newName.setBounds(280, 65, 60, 20);
  jPanel.add(newName);
  JLabel password = new JLabel("密码找回");
  password.setBounds(280, 120, 60, 20);
  jPanel.add(password);
  JCheckBox remember = new JCheckBox("记住密码");
  remember.setBounds(110, 160, 110, 20);
  jPanel.add(remember);
  JCheckBox automatic = new JCheckBox("自动登陆");
  automatic.setBounds(225, 160, 110, 20);
  jPanel.add(automatic);
  this.add(jPanel);
  this.setVisible(true);
  
 }
 public static void main(String[] args) {
  new Student("学生管理系统");
 }
}

原文地址:https://www.cnblogs.com/chenyangpeng/p/5414511.html