首页 > 其他 > 详细

界面的实现

时间:2015-10-02 19:54:47      阅读:254      评论:0      收藏:0      [点我收藏+]
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);
		
		
		
	}
}

  

界面的实现

原文:http://www.cnblogs.com/xiaziteng/p/4852598.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!