有什么方法可以在Frame里面显示gif?

liyihua 2002-03-22 04:10:47
有什么方法可以在Frame里面显示gif?
...全文
118 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
javafounder 2002-03-22
  • 打赏
  • 举报
回复
最好的方法是在JFrame上加一个JPanel的子类,你在该子类中重写paintComponent,那样你在panel上不但可以画图像,你想画什么都
可以了:)
肖尧19 2002-03-22
  • 打赏
  • 举报
回复
先import javax.swing.*
JFrame frame=new JFrame();
Container con=frame.getContentPane();
JLabel label=new JLabel(new ImageIcon("icon.gif"));
con.add(label,BorderLayout.CENTER);
frame.setBounds(100,100,100,100);
frame.show();
(把图片换成你的)
liyihua 2002-03-22
  • 打赏
  • 举报
回复
一: 我不是用Jb
二: new Label(new Image("mygif.gif")); // 没有这个方法
hexiaofeng 2002-03-22
  • 打赏
  • 举报
回复
JLable
samwong 2002-03-22
  • 打赏
  • 举报
回复
Label gif=new Label(new Image("mygif.gif"));
frame.add(gif);
GJA106 2002-03-22
  • 打赏
  • 举报
回复
private ImageIcon iconPoint1;

在private void jbInit() throws Exception中添加
iconPoint1 = new ImageIcon(Toolkit.getDefaultToolkit().getImage(System.getProperty("user.dir")+"/images/point1.gif"));
mJLabelName1.setIcon(iconPoint1);
this.validate();

23,407

社区成员

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

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