package jas2.swingstudio;
import jas2.util.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import javax.swing.*;
import javax.swing.filechooser.*;
import javax.swing.filechooser.FileFilter; // not java.io.FileFilter
public class MultiFilePanel extends JPanel
{
public MultiFilePanel(FileFilter f, String description, String borderText,String key)
{
filter = f;
this.description = description;
this.borderText = borderText;
this.key = key;
this.fileList = new FileList();
setLayout(new BorderLayout());
ar = new FileAddRemovePanel(fileList, description, borderText);
add(ar,BorderLayout.CENTER);
clear = new JButton("Clear File Set");
save = new JButton("Save File Set...");
restore = new JButton("Restore File Set...");
clear.addActionListener(ar);
save.addActionListener(ar);
restore.addActionListener(ar);
JPanel p = new JPanel(new GridLayout(3,1));
p.add(clear);
p.add(save);
p.add(restore);
add(p,BorderLayout.EAST);
}
public int getNFiles()
{
ar.update();
return fileList.getSize();
}
public String getFilePath()
{
ar.update();
StringBuffer path = new StringBuffer();
Enumeration e = fileList.elements();
while (e.hasMoreElements())
{
path.append(e.nextElement().toString());
if (!e.hasMoreElements()) break;
path.append(java.io.File.pathSeparatorChar);
}
return path.toString();
}
public void saveState()
{
ar.update();
String[] files = new String[fileList.getSize()];
Enumeration e = fileList.elements();
for (int i=0; i
Ads help maintain this website.