怎样用java语句实现 类似QQ表情的弹出窗口?

mothz 2007-09-01 04:53:18
新手,找了很多资料还是没有做出来,,,希望高手能帮下忙
...全文
917 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
beliveke 2010-11-04
  • 打赏
  • 举报
回复
我也想知道这个
abc_abc_a 2010-03-11
  • 打赏
  • 举报
回复
fileName= "G:\\em\\e "+i+ ".gif ";//楼主这个是不是图片存放的位置????
在硬盘中应该是这个位置G:\em\e\图片.gif。。。。。。只要把图片放在这个位置,你刚刚写的程序就可以运行了啊。。结果就是点击图片那个按钮弹出一个层,上面有表情。
whlxjq520 2008-12-27
  • 打赏
  • 举报
回复
很好 但我现在是表情发送的问题!
刘葛曦 2008-12-25
  • 打赏
  • 举报
回复
你的代码不行呀???、有问题!
justgreen999 2008-08-08
  • 打赏
  • 举报
回复
测试过了 能行
swvincent 2007-09-07
  • 打赏
  • 举报
回复
import java.awt.*;
import javax.swing.*;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class DemoTest
extends JFrame {
public DemoTest() {
try {
jbInit();
this.setExtendedState(this.MAXIMIZED_BOTH);
this.setVisible(true);
}
catch (Exception exception) {
exception.printStackTrace();
}
}

private void jbInit() throws Exception {
getContentPane().setLayout(null);
showIco.setText("图片");
showIco.setBounds(new Rectangle(50, 75, 39, 37));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jButton1.addActionListener(new DemoTest_jButton1_actionAdapter(this));
this.getContentPane().add(showIco);
this.getContentPane().add(jButton1);
jButton1.setBounds(new Rectangle(109, 81, 88, 25));
jButton1.setText("选择");
}

public static void main(String[] args) {
DemoTest demotest = new DemoTest();
}

JLabel showIco = new JLabel();
JButton jButton1 = new JButton();
public void jButton1_actionPerformed(ActionEvent e) {
this.showIco.setText("");
Frame1 f=new Frame1(this);
}
}

class DemoTest_jButton1_actionAdapter
implements ActionListener {
private DemoTest adaptee;
DemoTest_jButton1_actionAdapter(DemoTest adaptee) {
this.adaptee = adaptee;
}

public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}

//测试类
图片自己到QQ网站下
swvincent 2007-09-07
  • 打赏
  • 举报
回复
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1
extends JWindow {
GridLayout gridLayout1 = new GridLayout();
JLabel[] ico=new JLabel[90];
Frame owner;


public Frame1(Frame owner) {
super(owner);
this.owner=owner;
try {
jbInit();
this.setBounds(300,0,350,210);
this.setAlwaysOnTop(true);
this.setVisible(true);
}
catch (Exception exception) {
exception.printStackTrace();
}
}

private void jbInit() throws Exception {
getContentPane().setLayout(gridLayout1);
gridLayout1.setColumns(15);
gridLayout1.setHgap(1);
gridLayout1.setRows(6);
gridLayout1.setVgap(1);
String fileName="";
// System.out.println(this.getClass().getResource("/"));
for(int i=0;i<ico.length;i++){
fileName="G:\\em\\e"+i+".gif";//修改图片路径
ico[i]=new JLabel(new ImageIcon(fileName));
final Icon img1=ico[i].getIcon();
ico[i].addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
((DemoTest)owner).showIco.setIcon(img1);
getObj().dispose();//这里最好用单例模式
}
});
this.getContentPane().add(ico[i]);
}
this.getContentPane().setBackground(SystemColor.text);

}
private JWindow getObj(){
return this;
}

}

//表情显示窗体
swvincent 2007-09-07
  • 打赏
  • 举报
回复
可以看一下这个javax.swing.JWindow类来做窗体
SnowingXimen 2007-09-07
  • 打赏
  • 举报
回复
SnowingXimen@163.com
SnowingXimen 2007-09-07
  • 打赏
  • 举报
回复
我用Java写的QQ,完全QQ界面风格的。
如果需要,我可以有偿给你。
beibeiG 2007-09-03
  • 打赏
  • 举报
回复
用 JDialog , 因为JDialog在windows的状态栏内没有显示,
可以用 setUndecorated(true) 去掉窗体头
jaguarlsl 2007-09-03
  • 打赏
  • 举报
回复
显示一个panel即可

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧