tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Pfeiffer <adamcpfeif...@yahoo.com>
Subject subclass constructor class
Date Thu, 09 May 2002 20:12:43 GMT
Hello,
superclass is: FileBrowserBean.java
subclass is:   PictureBrowserBean.java

When I try to call the constructor in FileBrowserBean.java from PictureBrowserBean.java I
get the
following compile time error:

PictureBrowserBean.java:10: Object() in java.lang.Object cannot be applied to (java.lang.String)
      super("/");
      ^
1 error

Here is the FileBrowserBean class
###################################

package mada.trips;

import java.io.*;
import java.util.*;

public class FileBrowserBean {

    String baseDirectory = null;
    ArrayList directories = new ArrayList();
    ArrayList files = new ArrayList();
    Iterator filesIt = null;
    Iterator directoriesIt = null;
    File baseDir = null;

    public FileBrowserBean (String directory) {
                setBaseDirectory(directory);
    }

    public FileBrowserBean () {

    }

    public void setBaseDirectory(String directory) {
                baseDirectory = directory;
                baseDir = new File(baseDirectory);
    }

    public void parseDirectory () {
            File fileList[] = null;

            directories.clear();
            files.clear();
                fileList = baseDir.listFiles();
                for(int i=0; i < fileList.length; i++) {
                        if (fileList[i].isDirectory()) {
                                directories.add(fileList[i].toString());
                        } else {
                                files.add(fileList[i].toString());
                        }
                }
                filesIt = files.iterator();
                directoriesIt = directories.iterator();
    }

    public boolean hasNextFile() {
                return filesIt.hasNext();
    }

    public String nextFile() {
                return filesIt.next().toString();
    }

    public boolean hasNextDirectory() {
                return directoriesIt.hasNext();
    }

    public String nextDirectory() {
                return directoriesIt.next().toString();
    }

    public String getBaseDirectory() {
        return baseDirectory;
    }

}

Here is the PictureBrowserBean class:
#####################################
package mada.trips;

import java.io.*;
import java.util.*;
import mada.trips.FileBrowserBean;

public class PictureBrowserBean {

   public PictureBrowserBean () {
      super("/");
   }

}


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message