/** |
* 功能:JTextField,JPassswordField,JLabel的简单使用 |
*/ |
package com.jiemian; |
import java.awt.*; |
import javax.swing.*; |
public class Text5 extends JFrame{ |
|
JTextField jtf1; |
JPasswordField jpf1; |
JLabel jl1,jl2; |
JButton jb1,jb2; |
JPanel jp1,jp2,jp3; |
public static void main(String[] args) { |
|
Text5 text5= new Text5(); |
} |
|
public Text5(){ |
|
//创建组件 |
jp1= new JPanel(); |
jp2= new JPanel(); |
jp3= new JPanel(); |
|
jtf1= new JTextField( 10 ); |
jpf1= new JPasswordField( 10 ); |
|
jl1= new JLabel( "管理员" ); |
jl2= new JLabel( "密 码" ); |
|
jb1= new JButton( "确 定" ); |
jb2= new JButton( "取 消" ); |
|
//设置布局管理器 |
this .setLayout( new GridLayout( 3 , 1 )); |
|
//添加组件 |
jp1.add(jl1); |
jp1.add(jtf1); |
|
jp2.add(jl2); |
jp2.add(jpf1); |
|
jp3.add(jb1); |
jp3.add(jb2); |
|
this .add(jp1); |
this .add(jp2); |
this .add(jp3); |
|
//对窗体进行设置 |
this .setIconImage(( new ImageIcon( "images\\head_boy.jpg" )).getImage()); |
this .setTitle( "会员管理系统" ); |
this .setSize( 300 , 180 ); |
this .setLocation( 300 , 300 ); |
this .setResizable( false ); |
this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
this .setVisible( true ); |
|
|
|
|
} |
} |