Java 导入图像文件,将其添加到ArrayList,然后按顺序显示图像
我正在尝试使用Java 导入图像文件,将其添加到ArrayList,然后按顺序显示图像,java,Java,我正在尝试使用JFileChooser将图像添加到ArrayList导入图像文件。最后,按下按钮后,在JPanel上按顺序显示图像。有人知道我怎么做吗?我是java新手 谢谢 将其分解为步骤 任务1:使用JFileChooser导入图像文件。 选择文件对象 使用(文件)获取缓冲图像 任务2:将图像添加到数组列表 List<BufferedImage> images = new ArrayList<BufferedImage>() images.add(image); 任
JFileChooser
将图像添加到ArrayList
导入图像文件。最后,按下按钮后,在JPanel
上按顺序显示图像。有人知道我怎么做吗?我是java新手
谢谢 将其分解为步骤 任务1:使用JFileChooser导入图像文件。 选择文件对象 使用(文件)获取缓冲图像 任务2:将图像添加到数组列表
List<BufferedImage> images = new ArrayList<BufferedImage>()
images.add(image);
任务4:添加在图像中前进的按钮
JButton advance = new JButton();
advance.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
advanceImage();
}
};
您可能想先开始学习一些Java GUI教程,您的问题非常笼统,涵盖了很多方面。为了避免我们重新编写已经编写的教程,请告诉我们,您做了什么?你知道什么?有什么特别让你困惑的?“有人知道我是怎么做到的吗?”是的。(我应该输入“是”作为答案吗?)
JButton advance = new JButton();
advance.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
advanceImage();
}
};