Class EditableFileList

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class EditableFileList extends EditableList
A component that displays an editable list of filenames.
See Also:
  • Constructor Details

    • EditableFileList

      public EditableFileList()
      Create an empty component.
    • EditableFileList

      public EditableFileList(JFileChooser c)
      Create an empty component, that uses a given file chooser to allow the user to specify new filenames to be added.
      Parameters:
      c - the file chooser to be used
      See Also:
  • Method Details

    • setBaseDirectory

      public void setBaseDirectory(File dir)
      Set the base directory to be displayed by the file chooser. "null" may be used to mean "the user's current directory".
      Parameters:
      dir - the directory to be displayed by the file chooser
    • setChooser

      public void setChooser(JFileChooser c)
      Set the file chooser used to display filenames when the user wants to add another file to the list.
      Parameters:
      c - the chooser to be used
    • setItems

      public void setItems(Object... items)
      Set the items in the list. Any previous items are removed first. The items should be files, or strings (which will be turned into files.)
      Overrides:
      setItems in class EditableList
      Parameters:
      items - the array of strings or files to be put in the list.
      See Also:
    • getFiles

      public File[] getFiles()
      Get the files currently in the list.
      Returns:
      the files currently in the list
      See Also:
    • setFiles

      public void setFiles(File... files)
      Set the files in the list, replacing any files currently there.
      Parameters:
      files - the files to be put in the list
      See Also:
    • getNewItem

      protected Object getNewItem()
      Invoked to get a new item to put in the list, when the user clicks the "Add" button". The current file chooser will be shown. If the user selects a file, it will be returned as the result of this method; otherwise, the result will be null, to indicate that no file was selected.
      Overrides:
      getNewItem in class EditableList
      Returns:
      a file to be added to the list, or null if none