import java.io.File;

import java.awt.*;
import javax.swing.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Window
{
	private JFrame window;
	private JPanel topPanel,
		buttonPanel,
		listPanel;
	private JButton add,
		del,
		clr;
	private JList list;
	private JFileChooser fileChooser;
	private File dir;

	public Window()
	{
		bListener listener = new bListener();

		window = new JFrame("Batch Uploader");

		topPanel = new JPanel();
		buttonPanel = new JPanel();
		listPanel = new JPanel();

		add = new JButton("Add");
		del = new JButton("Delete");
		clr = new JButton("Clear");

		list = new JList();

		fileChooser = new JFileChooser();
		fileChooser.setApproveButtonText("Load files");

		fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

		add.addActionListener(listener);
		del.addActionListener(listener);
		clr.addActionListener(listener);

		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		buttonPanel.add(add);
		buttonPanel.add(del);
		buttonPanel.add(clr);

		listPanel.add(list);

		topPanel.setLayout(new BorderLayout());
		topPanel.add(listPanel, BorderLayout.SOUTH); 
		topPanel.add(buttonPanel, BorderLayout.NORTH);

		window.add(topPanel);
		window.pack();
		window.setVisible(true);
	}

	private class bListener implements ActionListener
	{
		public void actionPerformed (ActionEvent e)
		{
			if(e.getSource() == add)
			{
				fileChooser.showDialog(window, null);
				dir = fileChooser.getSelectedFile();

				list.setListData(dir.listFiles());
			}
			else if(e.getSource() == del)
			{
				return;
			}
			else if(e.getSource() == clr)
			{
				list.setListData(new Object[1]);
			}
		}
	}
}

@@ -253,16 +253,23 @@
 on add,%0A
+%09%09clr,%0A
 %09%09del,%0A%09
@@ -269,19 +269,19 @@
 %09del,%0A%09%09
-clr
+upl
 ;%0A%09priva
@@ -567,16 +567,46 @@
 %22Add%22);%0A
+%09%09clr = new JButton(%22Clear%22);%0A
 %09%09del = 
@@ -626,27 +626,27 @@
 Delete%22);%0A%09%09
-clr
+upl
  = new JButt
@@ -645,29 +645,30 @@
 ew JButton(%22
-Clear
+Upload
 %22);%0A%0A%09%09list 
@@ -873,16 +873,51 @@
 tener);%0A
+%09%09clr.addActionListener(listener);%0A
 %09%09del.ad
@@ -937,35 +937,35 @@
 er(listener);%0A%09%09
-clr
+upl
 .addActionListen
@@ -1108,16 +1108,40 @@
 dd(clr);
+%0A%09%09buttonPanel.add(upl);
 %0A%0A%09%09list
@@ -1770,16 +1770,71 @@
 );%0A%09%09%09%7D%0A
+%09%09%09else if(e.getSource() == upl)%0A%09%09%09%7B%0A%09%09%09%09return;%0A%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%7D

add upload button stub