想在每个表情画一个框,但是有些框不会出现。。
表情包在这里下载:http://u.115.com/file/t95377871e
face.rar
public class   ExpressionDialog extends JDialog{

JLabel label;
int x,y;
final private int WIDTH=30,HEIGHT=30;
public ExpressionDialog(JFrame frame,int xx,int yy)
{

    super(frame);
    
    setUndecorated(true);
setLayout(new GridLayout(8,15));
setBounds(xx, yy, 451, 242);
setBackground(Color.blue);
for(x=0;x<120;x++)
{
label=new JLabel(new ImageIcon("image/face/"+x+".gif"));
// System.out.println("image/face/"+x+".gif");

add(label);

}
addWindowListener(new winAction());
addMouseListener(new Action());
}

 public void paint(Graphics g)
{
    super.paintComponents(g); 
g.setColor(new Color(0,0,0));
for(x=0;x<=450;x=x+WIDTH)
for(y=0;y<=230;y=y+HEIGHT)
g.drawRect(x, y, x+HEIGHT, y+WIDTH);

} class Action extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
x=e.getX()/30;
y=e.getY()/30;
//repaint();
 JFrame frame  = (JFrame) ExpressionDialog.this.getOwner();
}

}
class winAction extends WindowAdapter
{ public void windowDeactivated(WindowEvent e) { //表情框失去焦点时调用
    ExpressionDialog.this.setVisible(false);
   // ExpressionDialog.this.setVisible(false);
}

}
}