java 做界面的问题2
package test;
import javax.swing.*;
import java.awt.Rectangle;
public class MyPanel extends JPanel
{
public MyPanel()
{
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setLayout(null);
jButton1.setBounds(new Rectangle(95, 87, 133, 45));
jButton1.setText( "jButton1 ");
jTextField1.setText( "jTextField1 ");
jTextField1.setBounds(new Rectangle(94, 200, 170, 77));
jTextArea1.setText( "jTextArea1 ");
jTextArea1.setBounds(new Rectangle(140, 303, 162, 53));
this.add(jButton1);
this.add(jTextField1);
this.add(jTextArea1);
}
JButton jButton1 = new JButton();
JTextField jTextField1 = new JTextField();
JTextArea jTextArea1 = new JTextArea();
}
package test;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.GridLayout;
public class Form extends JFrame
{
public Form()
{
try
{
jbInit();
} catch (Exception ex)
{
ex.printStackTrace();
}
}
MyPanel panel1 = new MyPanel();
MyPanel panel2 = new MyPanel();
MyPanel panel3 = new MyPanel();
MyPanel panel4 = new MyPanel();
MyPanel panel5 = new MyPanel();