界面的实现

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class International extends JPanel{
	
	private static int WIDTH= 600;
	private static int HEIGHT=600;
	private JButton bt;
	private JTextField tf;
	private JTextField tf2;
	
	public International(){
		init();
	}
	
	public void init(){
		this.setLayout(null);
		//setFocusable(true);
		
		bt= new JButton("按钮");
		bt.setBounds(10,10,100,30);
		this.add(bt);
		
		tf = new JTextField();
		tf.setBounds(100,10,300,30);
		this.add(tf);
		
		tf2 = new JTextField();
		tf2.setBounds(10,200,300,30);
		this.add(tf2);
		
	}
	
	
	

	public static void main(String[] args) {
		JFrame frame = new JFrame("界面");
		International in = new International();
		
		frame.add(in);
		frame.setSize(WIDTH,HEIGHT);
		frame.setAlwaysOnTop(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);
		
		
		
	}
}

  

posted @ 2015-10-02 19:31  夏子藤  阅读(178)  评论(0编辑  收藏  举报