简体   繁体   English

从哪里获得image io包?

[英]Where to get image io package?

Where do I get the api for imageIO? 我在哪里可以获得imageIO的API?

So That i can use functions like 这样我就可以使用像

String imagePath = "C:/programs/";
    File inFile = new File(imagePath, "single image.gif");
    BufferedImage image = ImageIO.read(inFile);

I plan on exporting this : import javax.imageio.ImageIO; 我计划导出此文件:import javax.imageio.ImageIO;

It's in the JDK. 在JDK中。 Simply: 只是:

import javax.imageio.ImageIO;

finnw is correct about the API. finnw关于API是正确的。 However, what do you want to do with the BufferedImage? 但是,您想对BufferedImage做什么? If you want it on a JLabel or as the icon for JOptionPane.showXXXDialog(), swing offers a good solution - class ImageIcon. 如果要在JLabel上使用它或将其作为JOptionPane.showXXXDialog()的图标,swing提供了一个很好的解决方案-类ImageIcon。 Easy construction and use, IMO. IMO易于构建和使用。 Regards, - MS 问候-MS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM