[求助]怎样设置面板大小和.....
import javax.swing.*;import java.awt.*;
public class Chat extends JApplet
{
JPanel pm,ps,pn,pe,pw,pc;
BorderLayout b;
public void init()
{
pm=new JPanel();
ps=new JPanel();
pn=new JPanel();
pe=new JPanel();
pw=new JPanel();
pc=new JPanel();
b=new BorderLayout();
pm.setLayout(b);
pm.add(ps,BorderLayout.SOUTH);
pm.add(pn,BorderLayout.NORTH);
pm.add(pe,BorderLayout.EAST);
pm.add(pw,BorderLayout.WEST);
pm.add(pc,BorderLayout.CENTER);
Color c1=new Color(195,242,247);
pn.setBackground(c1);
/* Color c2=new Color(246,17,50);
pn.setForeground(c2); */
FlowLayout f1=new FlowLayout(FlowLayout.CENTER);
pn.setLayout(f1);
JLabel L1=new JLabel("Software 2005(1) Chatroom");
// L1.setFont(2,1);
pn.add(L1);
// pn.setSize(8,90);
JLabel L2=new JLabel("Message:");
JTextField t1=new JTextField(65);
JButton b1=new JButton("Send");
JButton b2=new JButton("Cancel");
Color c3=new Color(249,170,224);
ps.setBackground(c3);
ps.add(L2);
ps.add(t1);
ps.add(b1);
ps.add(b2);
// ps.setSize(80,5);
FlowLayout g=new FlowLayout();
pw.setLayout(g);
JLabel L3=new JLabel("Name:");
JTextField t2=new JTextField(10);
JLabel L4=new JLabel("Password:");
JPasswordField p=new JPasswordField(8);
JButton b3=new JButton("Login");
JButton b4=new JButton("Cancel");
Color c4=new Color(212,245,180);
pw.setBackground(c4);
pw.add(L3);
pw.add(t2);
/* pw.add(L4);
pw.add(p);
pw.add(b3);
pw.add(b4);
*/
/* FlowLayout f2=new FlowLayout(FlowLayout.TRAILING);
pc.setLayout(f2);*/
JTextArea a1=new JTextArea(40,82);
Color c5=new Color(156,236,244);
pc.setBackground(c5);
pc.add(a1);
JTextArea a2=new JTextArea(32,13);
Color c6=new Color(248,248,206);
pe.setBackground(c6);
pe.add(a2);
// pe.setSize(46,15);
this.getContentPane().add(pm);
}
}
请问怎样设置字体大小和颜色 就在27行和32行?怎样设置面板大小(34行)我设置的不起作用,错在那里?
还有怎样把pm面板中的L4,p放到第2行。把b3,b4放到第3行????????????
[此贴子已经被作者于2006-3-19 12:55:50编辑过]