在JLabel中显示BMP [英] Display BMP in JLabel

查看:262
本文介绍了在JLabel中显示BMP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java可以显示png,jpg等一些其他图片格式,但我必须通过获取文件路径在JLable中显示bmp文件。

Java can display png, jpg a some other picture formats, but i have to display a bmp file in a JLable by getting the file path.

ImageIcon imageIcon = new ImageIcon(imageFile.getAbsolutePath());

ImageIcon支持典型的 png,gif,jpg 图像。

ImageIcon support the typical png,gif,jpg images.

在我工作的项目中,我无法打开bmp文件并将相同的文件存储为jpg,因为我不允许在运行。我只能在内存中生成图像。但我不知道该怎么做。

In the project i am working, i can not open a bmp file and store the same file as a jpg, because i am not allow to store something at runtime. I could only generate the image in hold it in memory. But i dont know how to do this.

如何在 Java中显示 BMP 1.4

谢谢

推荐答案

我找到了一些用Java 1.5编写的类,但你可以轻松更新2个类,这样就可以使用1.4中的类。

I find some classes written in Java 1.5 but you can easily update 2 classes so that you can use the classes in 1.4.

imag4j 可以将bmp和ico文件转换为BufferedImage您可以在java中显示的对象。
你可以导入17个类,并且因为java 1.5语句而必须更新10行。

imag4j can convert bmp and ico files to BufferedImage objects you can display in java. You can import 17 classes and have to update maybe 10 lines because of java 1.5 statements.

你得到的bmp转换器工作正常。

You get a bmp converter which is working very fine.

这篇关于在JLabel中显示BMP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆