做了一个类似QQ表情框,有点问题,请大家看下。。
想在每个表情画一个框,但是有些框不会出现。。
表情包在这里下载:http://u.115.com/file/t95377871e
face.rar
表情包在这里下载: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);
}
}
}
...全文
相关推荐
Android仿 QQ 微信 表情
嫌分高?那你回去看博客http://blog.csdn.net/lnb333666/article/details/8546497
Android 模仿手机QQ表情输入和表情预览框
闲来无事花了一点空暇时间写了一个模仿Android版手机QQ的表情输入框 地址:http://blog.csdn.net/shallcheek/article/details/48380871
QQFace模仿QQ弹出表情框 可视化 所有表情一页一页显示
模仿QQ弹出表情框 可视化 所有表情一页一页显示
类似QQ表情
类似于QQ表情一样的效果,主要是窗体程序
老版QQ原生表情gif动态
这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。


Java SE
