標籤:
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);}}
介面的實現