import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class  Labe extends JFrame 
{


private Label l1 = new Label("red");
private Label l2 = new Label("yellow");
private Label l3 = new Label("blue");
public class WindowCloser extends WindowAdapter
{

public void windowClosing(WindowEvent we)
{
System.out.println("hello com in");
we.getWindow().setVisible(true);
((Window)we.getComponent()).dispose();
System.exit(0);}
}public Labe()
{
/*JFrame f = new JFrame();
f.add(new WindowCloser());*/

setLayout(new FlowLayout());

add(l1);add(l2);add(l3);
l1.setBackground(Color.red);
l2.setBackground(Color.yellow);
l3.setBackground(Color.blue);

/*setSize(300,300);*/
pack();
setVisible(true);
}
public static void main(String[] args) 
{
Labe l = new Labe();

}
}
public void windowClosing(WindowEvent we)为什么没有调用
还有就是pack()在里面起到了什么作用..