import java.awt.*;
import javax.swing.*;
public class L5_7 extends JFrame{
JButton an1,an2;
JPanel mb1,mb2,mb3;
JLabel bq1,bq2;
JTextField wb1;
JPasswordField mmk;
L5_7(){
mb1=new JPanel();
mb2=new JPanel();
mb3=new JPanel();
an1=new JButton("登陆");
an2=new JButton("取消");
bq1=new JLabel("用户名");
bq2=new JLabel("密 码");
wb1=new JTextField(10);
mmk=new JPasswordField(10);
this.setLayout(new GridLayout(3,1));
mb1.add(bq1); mb1.add(wb1);
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(230,150);
this.setLocation(200, 300);
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
L5_7 Kk = new L5_7();
}
}
请编辑设计一个登陆界面,要求输入帐号和密码(不考虑事件)
最新推荐文章于 2024-12-26 16:20:07 发布
本文介绍了一个简单的Java Swing用户登录界面实现案例。该界面包括用户名输入框、密码输入框及登录与取消按钮,并展示了如何使用JFrame、JPanel等Swing组件进行布局。
1191

被折叠的 条评论
为什么被折叠?



