java窗口登陆

import javax.swing.*;
import java.awt.*;
import java.util.Random;
public class Windows {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		Random ra=new Random();
		int num=ra.nextInt(1000)+1000;
		JFrame window1=new JFrame("用户登录");
        Container con=window1.getContentPane();
        con.setBackground(Color.red);
        window1.setBounds(60,100,400,300);
        window1.setLayout(null);
        JLabel l1=new JLabel("用户名");
        JLabel l2=new JLabel("密码");
        JLabel l3=new JLabel("验证码");
        JLabel l4=new JLabel(Integer.toString(num));        
        JPasswordField j=new JPasswordField(10);
        JTextField j1=new JTextField(10);
        JTextField j2=new JTextField(10);
        JButton b1=new JButton("确定");
        JButton b2=new JButton("重置");
        JButton b3=new JButton("取消");
        window1.setVisible(true);
        window1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window1.add(l1);
        l1.setBounds(30,30,50,50);
        window1.add(j1);
        j1.setBounds(100,46,100,20);
        window1.add(l2);
        l2.setBounds(30,60,100,100);
        window1.add(j);
        j.setBounds(100,96,100,20);
        window1.add(l3);
        l3.setBounds(30,140,50,50);
        window1.add(j2);
        j2.setBounds(100,148,100,20);
        window1.add(l4);
        l4.setBounds(222,119,100,100);
        window1.add(b1);
        b1.setBounds(30,200,100,30);
        window1.add(b2);
        b2.setBounds(130,200,100,30);
        window1.add(b3);	
        b3.setBounds(230,200,100,30);
        		
  	}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值