zoukankan      html  css  js  c++  java
  • 界面的实现

    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);
    		
    		
    		
    	}
    }
    

      

  • 相关阅读:
    字符串String
    冒泡排序、二分查找法
    数组习题
    数组
    附加习题
    编写Java程序,应用for循环打印菱形、三角形
    JAVA的语法基础4
    3.20 每日一题题解
    3.19 每日一题题解
    3.18 每日一题题解
  • 原文地址:https://www.cnblogs.com/xiaziteng/p/4852598.html
Copyright © 2011-2022 走看看