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