Geniuses/src/project3/Maintenance.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project3;

/**
 *
 * @author Lucielsa
 */
import java.awt.BorderLayout;
import java.awt.*;
import java.awt.event.*;
import java.awt.GridLayout;
import javax.swing.*;
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import java.io.*;


public class Maintenance extends JFrame {

   private JButton btAddFile = new JButton ("Add File");
   private JButton btRemoveFile = new JButton ("Remove File");
   private JFileChooser addFile = new JFileChooser();
   private JTextArea log = new JTextArea(5,20);
   private JLabel titleFile = new JLabel ("Added Files:");
   private int count = 0;

public Maintenance (){

    JLabel title1 = new JLabel ();
           title1.setIcon(new javax.swing.ImageIcon(getClass().getResource("G.jpg")));

           log.setMargin(new Insets(5,5,5,5));
           log.setEditable(false);
          JScrollPane logScrollPane = new JScrollPane(log);
           log.append("Added Files: \n\n" );


   JPanel p1 = new JPanel(); p1.setBackground(Color.WHITE);
   JPanel p2 = new JPanel(); p2.setBackground(Color.WHITE);
   JPanel p3 = new JPanel(); p3.setBackground(Color.WHITE);

    p1.add(title1);
    //p2.add(titleFile);
   // p2.add(new JLabel ("                         "));
    p2.add(log);
    p3.add(new JLabel ("                         "));
    p3.add(btAddFile);
    p3.add(new JLabel ("                         "));
    p3.add(btRemoveFile);
    p3.add(new JLabel ("                         "));

    add(p1, BorderLayout.NORTH);
    add(p2, BorderLayout.CENTER);
    add(p3, BorderLayout.SOUTH);

    btAddFile.addActionListener(new ButtonListeneradd());
  }

private class ButtonListeneradd implements ActionListener {
@Override
       public void actionPerformed(ActionEvent e) {
        try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    SwingUtilities.updateComponentTreeUI(addFile);
                } catch (Exception ea) {
                    ea.printStackTrace();
                }
                int returnVal = addFile.showOpenDialog(Maintenance.this);
                   count++;
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = addFile.getSelectedFile();
                     log.append( "                " + count + ") " + file.getName() + ".\n" );
                }
           }
      }

}