import java.awt.*;
import javax.swing.*;
public class Test extends JFrame{//把需要的组件全部在这里定义
JPanel mb1,mb2,mb3;
JButton an1,an2;
JLabel bq1,bq2;
JTextField wbk;
JPasswordField mmk;
public static void main(String[] args){
Test lx=new Test();
}
public Test(){
mb1=new JPanel();
mb2=new JPanel();
mb3=new JPanel();
bq1=new JLabel("用户名");
bq2=new JLabel("密 码");
an1=new JButton("登录");
an2=new JButton("取消");
wbk=new JTextField(10);
mmk=new JPasswordField(10);
this.setLayout(new GridLayout(3,1));
mb1.add(bq1);
mb1.add(wbk);
mb2.add(bq2);
mb2.add(mmk);
mb3.add(an1);
mb3.add(an2);
this.add(mb1);
this.add(mb2);
this.add(mb3);
this.setTitle("用户登录");
this.setSize(330,190);
this.setLocation(350,280);
this.setResizable(false);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}
文本框和标签
猜你喜欢
转载自blog.csdn.net/WYJ____/article/details/82490667
今日推荐
周排行