java [23] 图形化 文本框、密码框、标签组件

package graph;

/*文本框
 * 密码框
 * 标签组件*/

import java.awt.*;
import javax.swing.*;

public class demo6 extends JFrame{
	JPanel jp1,jp2,jp3;
	JLabel jlb1,jlb2;
	JButton jb1,jb2;
	JTextField jtf1;
	JPasswordField jpf1;
	public static void main(String[] args) {
		demo6 demo = new demo6();
		
		
	}
	public demo6() {
		jp1 = new JPanel();
		jp2 = new JPanel();
		jp3 = new JPanel();
		
		jlb1 = new JLabel("Manager");
		jlb2 = new JLabel("Password");
		
		jb1 = new JButton("确认");
		jb2 = new JButton("取消");
		
		//10 表示宽度 
		jtf1 = new JTextField(10);
		jpf1 = new JPasswordField(10);
		
		this.setLayout(new GridLayout(3, 1));
		
		//加入组件
		jp1.add(jlb1);
		jp1.add(jtf1);
		
		jp2.add(jlb2);
		jp2.add(jpf1);
		
		jp3.add(jb1);
		jp3.add(jb2);
		
		this.add(jp1);
		this.add(jp2);
		this.add(jp3);
		
		this.setTitle("会员管理系统");
		this.setSize(300, 150);
		this.setLocation(300, 300);
		this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
		this.setVisible(true);
		
		
		
	}

}

猜你喜欢

转载自blog.csdn.net/qq_38125626/article/details/81285997
今日推荐