Im trying to under stand this program I found
Im trying to under stand this program I found. Where should the methods go within this prog. But I'm unable to fix the method problem.
Error messages
GraphicUserInterface.java:47: cannot find symbol
symbol : method getPath()
location: class java.io.File[]
System.out.println("GUI deleteFiles - file #" + i + " to delete = " + bob.getPath());
^
GraphicUserInterface.java:48: cannot find symbol
symbol : method Delete()
location: class java.io.File[]
bob.Delete();
2 errors ^
[CODE]
import java.io.File
import javax.swing.filechooser.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GraphicUserInterface
{
JFrame commandFrame;
JPanel commandPanel;
JFileChooser thePlanetsBrowser;
JButton deleteSelectedFilesButton;
File DirBit = new File("C:\\Documents and Settings\\Loop\\Desktop\\theGrey");
public GraphicUserInterface()
{
JFrame.setDefaultLookAndFeelDecorated(true);
commandFrame = new JFrame("At your command");
commandFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
commandPanel = new JPanel(new GridBagLayout());
thePlanetsBrowser = new JFileChooser(DirBit);
thePlanetsBrowser.setMultiSelectionEnabled(true);
commandPanel.add(thePlanetsBrowser);
deleteSelectedFilesButton = new JButton("Delete selected files");
deleteSelectedFilesButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
deleteSelectedFilesButtonActionPerformed();
System.out.println("GUI deleteSelectedFilesButton Listener - deletion finished");
}
});
commandPanel.add(deleteSelectedFilesButton);
commandFrame.getContentPane().add(commandPanel, BorderLayout.CENTER);
commandFrame.pack();
commandFrame.setVisible(true);
}
public void deleteSelectedFilesButtonActionPerformed()
{
File[] bob = thePlanetsBrowser.getSelectedFiles();
System.out.println("GUI deleteSelectedFilesButton - # of files to delete = " + bob.length);
if (thePlanetsBrowser.getCurrentDirectory().equals(DirBit))
{
System.out.println("GUI deleteFiles - directory is OK");
for (int i = 0; i < bob.length; i++)
{
System.out.println("GUI deleteFiles - file #" + i + " to delete = " + bob.getPath());
bob.delete();
System.out.println("GUI deleteFiles - deleted");
}
}
try
{
thePlanetsBrowser.rescanCurrentDirectory();
System.out.println("GUI deleteFiles - rescan done");
}
catch (java.lang.ArrayIndexOutOfBoundsException e)
{
System.out.println("HERE IS THE ArrayIndexOutOfBoundsException: " + e);
}
}
private static void createAndShowGUI()
{
new GraphicUserInterface();
}
public static void main(String[] args)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
createAndShowGUI();
}
});
}
}[/CODE]

