CODE
class ScanForCertificateStore extends JFrame {
FindCertificates fc;
ScanForCertificateStore sfcs=this;
DefaultListModel lmRoot = new DefaultListModel();
JList lbRoot = new JList(lmRoot);
JScrollPane spRoot = new JScrollPane(lbRoot);
JButton bStartScan = new JButton("Start Scan of Selected ");
File[] Roots;
public ScanForCertificateStore (FindCertificates fc) {
this.fc = fc;
final Container p = getContentPane();
setSize(200,200);
setLocation(100,100);
p.setLayout(new BorderLayout());
p.add(spRoot,BorderLayout.CENTER);
File f = new File("\\");
Roots = f.listRoots();
for(int i=0;i<Roots.length;i++){
lmRoot.addElement(Roots[i].getAbsolutePath());
}
p.add(bStartScan,BorderLayout.SOUTH);
bStartScan.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// dfeine new layout
JPanel aPanel = new JPanel(new BorderLayout()),
bPanel = new JPanel(new BorderLayout());
final DefaultListModel lmFound = new DefaultListModel();
JList lbFound = new JList(lmFound);
JButton bAbort = new JButton("Abort Scanning Computer"),
bSelect = new JButton("Select a Certificate Store");
final JTextArea taReport = new JTextArea("");
JScrollPane spFound = new JScrollPane(lbFound),
spReport = new JScrollPane(taReport);
aPanel.add(spReport,BorderLayout.CENTER);
aPanel.add(bAbort,BorderLayout.SOUTH);
bPanel.add(spFound,BorderLayout.CENTER);
bPanel.add(bSelect,BorderLayout.SOUTH);
p.removeAll(); // fisrt removeAll() (second isn't there jet..
p.add(aPanel,BorderLayout.NORTH); // These componets don't show up on tyhe frame...
p.add(bPanel,BorderLayout.SOUTH); //
ArrayList a = new ArrayList();
for(int i=0;i<lmRoot.size();i++) {
if(lbRoot.getSelectionModel().isSelectedIndex(i)) {
a.add(Roots[i]);
}
}
Object[] o = a.toArray();
//File[] ff= (File[]) a.toArray();
ScanComputer sc = new ScanComputer(o, sfcs.fc.tfStore.getText());
sc.addReporter(new Report() {
public void action(String msg) {
taReport.append(msg);
taReport.setCaretPosition(taReport.getText().length());
repaint();
}
});
sc.addStore(new Report () {
public void action(String msg) {
lmFound.addElement(msg);
repaint();
}
});
sc.addFinish(new Report() {
public void action (String msg) {
}
});
sc.start();
}
});
}
}

