Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 导入图像文件,将其添加到ArrayList,然后按顺序显示图像_Java - Fatal编程技术网

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();
  }
};