Thursday 23 May 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...