[求助]怎样设置面板大小
import javax.swing.*;import java.awt.*;
public class Chatroom extends JApplet
{
JPanel pm,pn,ps,pw,pe,pc;
BorderLayout b;
public void init()
{
pm=new JPanel();
pn=new JPanel();
ps=new JPanel();
pw=new JPanel();
pe=new JPanel();
pc=new JPanel();
b=new BorderLayout();
pm.setLayout(b);
pm.add(pn,BorderLayout.NORTH);
pm.add(ps,BorderLayout.SOUTH);
pm.add(pw,BorderLayout.WEST);
pm.add(pe,BorderLayout.EAST);
pm.add(pc,BorderLayout.CENTER);
JLabel lbiaoti=new JLabel("Software Chatroom");
Color c1=new Color(197,248,184);
pn.setBackground(c1);
Color c2=new Color(246,17,50);
lbiaoti.setForeground(c2);
lbiaoti.setFont(new Font("楷体",Font.PLAIN,36));
pn.add(lbiaoti);
Color c3=new Color(249,170,224);
ps.setBackground(c3);
JLabel lmessage=new JLabel("Message:");
ps.add(lmessage);
JTextField tmessage=new JTextField(50);
ps.add(tmessage);
JButton bsend,bcanel;
Icon i=new ImageIcon("D:\\tupian\\send.jpg");
bsend=new JButton(i);
bcanel=new JButton("Canel");
bsend.setBackground(c3);
ps.add(bsend);
ps.add(bcanel);
JPanel pw1=new JPanel();
JLabel lname,lpassword;
lname=new JLabel("Name:");
lpassword=new JLabel("Password:");
JTextField tname,tpassword;
tname=new JTextField(8);
tpassword=new JTextField(6);
Color c4=new Color(218,247,230);
pw.setBackground(c4);
pw1.setBackground(c3);
// pw1.setLayout(null);
// pw1.setSize(1285,160);
pw1.add(lname);
pw1.add(tname);
pw1.add(lpassword);
pw1.add(tpassword);
pw.add(pw1);
JTextArea tac=new JTextArea(40,82);
Color c5=new Color(156,236,244);
pc.setBackground(c5);
pc.add(tac);
JTextArea tae=new JTextArea(32,13);
Color c6=new Color(248,248,206);
pe.setBackground(c6);
pe.add(tae);
this.getContentPane().add(pm);
}
}
怎样设置pw1的大小,我写的那两行有错 运行不出现左面的那个面板