langlove

总结:主要是如何布局。还是存在很大问题

package clientFrame;

import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;

public class see extends JFrame {
	// 做一个登陆的密码,账户框。2个h文本框,2个label
	JLabel jl1, jl2;
	JButton jb;
	JPasswordField pf;
	JTextField tf1, tf2;

	public see() {
		jl1 = new JLabel("用户名:");
		jb = new JButton("登  陆");
		jl2 = new JLabel("密   码:");
		tf1 = new JTextField(10);
		pf = new JPasswordField(10);
		tf2 = new JTextField(10);
		this.setVisible(true);
		this.setLayout(new FlowLayout());
		this.add(jl1);
		this.add(tf1);
		this.add(jl2);
		this.add(pf);
		// this.add(tf2);
		this.add(jb);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setSize(200, 200);
	}

	public static void main(String[] args) {

		see s = new see();
	}
}

  

分类:

技术点:

相关文章:

  • 2021-10-29
  • 2021-10-29
  • 2022-01-15
  • 2022-01-01
  • 2021-11-23
  • 2021-11-29
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-11-23
  • 2022-02-09
  • 2021-11-13
相关资源
相似解决方案