Java Program: Photo Viewer 1. Write an app called viewer that will have a Label at the top saying \"My Viewer\" (or something like that) 2. Will have JButtons at the bottom that will do Next, Previous, and Quit 3. Have the whole middle be a JLabel in which you will display Images stored in a directory. 4. The directory can be named Resource. 5. When you run the program (java viewer) it will read all the names in the Resource Directory. Then, when you click Next or Previous it will display an Image. 6. Note: you will need to find a java method that exists for reading a whole directory of filenames. You can store all those names in a String Array when run the program. 7. You will use a counter or index that is an int an when you click Next it will increment the counter until it reach some maximum value and then you will set it to 0. Previous will decrement the counter until it goes negative and then it will set the counter to the Maximum index ( which is how many filenames you have in the Image names array) 8. Submit the program viewer.java I should be able to use it with my own Resource directory. Solution Please refer this code for your application : -------------------------------------------------------------------------------------------------------------------- -------------- import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; public class ImageViewer extends javax.swing.JFrame { public ImageViewer() { initComponents(); listFiles(Path); //Lists all the files in the directory on window opening setLabelIcon(Path,filenames[position]); //sets the label to display the first //image in the directory on window opening. PreviousButton.setEnabled(false); } /** *Initialize components */ private void initComponents() { setTitle(\"Image Viewer\"); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new java.awt.BorderLayout());// The layout is BorderLayout //setBorder(javax.swing.BorderFactory.createEtchedBorder()); setBackground(java.awt.Color.GRAY); picLabel = new javax.swing.JLabel(); //Create the Label to display the picture picLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); picLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); PreviousButton = new javax.swing.JButton(); PreviousButton.setText(\"Previous\"); PreviousButton.setIconTextGap(10); //Distance between the icon and text is 10 PreviousButton.addActionListener(new java.awt.event.ActionListener() { //Register an actionListener for the PreviousButton public void actionPerformed(java.awt.event.ActionEvent evt) { PreviousButtonActionPerformed(evt); } }); NextButton = new javax.swing.JButton(); NextButton.setPreferredSize(PreviousButton.getPreferredSize()); NextButton.setText(\"Next\"); NextButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); NextButton.setIconTextGap(10); //Distance between the icon and text is 10 NextButton.addActionListener(new java.awt.event.ActionL.