码迷,mamicode.com
首页 > 其他好文 > 详细

界面的实现

时间:2015-10-02 19:55:49      阅读:147      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!