Thursday, May 23, 2019

java - Display multiple images

I need to show images and images numbers are unknown - maybe 5 maybe 10 maybe more and I have no idea how I should display them.




This is my code and display only one image.



public class NewClass extends JFrame {

public static void main(String []args) throws IOException{
BufferedImage img=ImageIO.read(new File("D:\\A-programmer-Life.jpg"));
ImageIcon icon=new ImageIcon(img);
JFrame frame=new JFrame();
frame.setLayout(new FlowLayout());

frame.setSize(500,500);
JLabel lbl=new JLabel();
lbl.setIcon(icon);
frame.add(lbl);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...