<dino2747@gmail.com> wrotw...
> I have some code that does a little bit of compress in a
> console but i want to convert to a GUI.
Have you tested it properly so you know that
your console version really worked?
> I am having trouble doing that. could some
> one look over this code and let me know where
> i am going wrong.
It would compile and the GUI itself could show, if it weren't for the method
analyzePath.
> public void analyzePath()
> {
You haven't declared any method "getFile" in SmallFileFrame.
> File name = getFile();
JTextField doesn't have any method "exists"
> if ( textField.exists() )
> {
JList doesn't have any method "setText"
> textArea.setText(String.format(
> "%s%s\n%s%s\n%s%s\n%s%s\n%s%s\n%s%s\n%s%s",
JTextField.getName does probably not do what you expect.
> textField.getName(), " exists",
JTextField doesn't have any method "isFile"
> ( textField.isFile() ? "is a file" : "is not a file" ),
JTextField doesn't have any method "length"
> "Length: ", textField.length(),
JTextField.getName does probably not do what you expect.
> textField1.getName(), " created",
JTextField doesn't have any method "length"
> "Length: ", textField1.length() ) );
> }
> else
[quoted text clipped - 4 lines]
> }
> }
I think you want something like...
public boolean analyzePath(String infilename, String outfilename)
{
File infile = new File(infilename);
File outfile = new File(outfilename);
if ( infile.exists() )
{
...
return true;
}
else
{
...
return false;
}
}
...and corresponding changes within the method.
Note that I suggest that you use the strings as arguments, instead of trying
to retrieve them from the GUI *within* the method. And actually I would
suggest that you try to avoid to put the results to the GUI from within the
method as well.
You could e.g. use a boolean return value in order to see if the operation
worked or not...
// Bjorn A