Class FileDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FileDialog extends Dialog
Emulator for FileDialog. Thin shell over the modal Dialog machinery; LOAD bridges the java.io.File semantic gap via a browser Upload staged to a per-session temp file.
See Also:
  • Field Details

    • LOAD

      public static final int LOAD
      This FileDialog is for reading a file (browser upload).
      See Also:
    • SAVE

      public static final int SAVE
      This FileDialog is for writing a file (browser download).
      See Also:
  • Constructor Details

    • FileDialog

      public FileDialog(Frame parent)
    • FileDialog

      public FileDialog(Frame parent, String title)
    • FileDialog

      public FileDialog(Frame parent, String title, int mode)
    • FileDialog

      public FileDialog(Dialog parent)
    • FileDialog

      public FileDialog(Dialog parent, String title)
    • FileDialog

      public FileDialog(Dialog parent, String title, int mode)
  • Method Details

    • getMode

      public int getMode()
    • setMode

      public void setMode(int mode)
    • getFile

      public String getFile()
    • setFile

      public void setFile(String file)
    • getFiles

      public File[] getFiles()
    • getDirectory

      public String getDirectory()
    • setDirectory

      public void setDirectory(String dir)
      The picker is the browser's and starts wherever the browser decides, so the directory is a hint nothing reads — it is the peer push that drops (R_decline_effect_only). It also holds only until the next show: the field is the one getDirectory() answers, and a completed LOAD overwrites it with the per-show temp dir, which is AWT's shape too — there the peer writes back the directory the user actually browsed to.
      Parameters:
      dir - "" is stored as null, as AWT's own body normalises it
    • isMultipleMode

      public boolean isMultipleMode()
    • setMultipleMode

      public void setMultipleMode(boolean multipleMode)
    • getFilenameFilter

      public FilenameFilter getFilenameFilter()
    • setFilenameFilter

      public void setFilenameFilter(FilenameFilter filter)
    • setVisible

      public void setVisible(boolean b)
      Populate the modal dialog with mode-appropriate content (LOAD: a browser Upload + OK/Cancel; SAVE: a filename TextField + Save/Cancel), then delegate to Dialog.setVisible(boolean) — which, since FileDialog is always modal, parks the calling virtual thread until a button handler or a peer-originated close disposes the dialog. After the park unwinds, finalizeResult() promotes the outcome to the result fields (and, for SAVE, opens the synthetic download dialog). Requires a virtual-thread (EHelper.callSwing) context per the inherited modal-park contract.

      The blocking applies to the name pick only, not to writing: SAVE returns as soon as the user clicks Save, so the app can write the file (synchronously or on a background thread) with no park in the way — the user pulls the bytes from the separate, non-modal download dialog whenever the write is done. See the class header for why a "block until written" SAVE would deadlock.

      Overrides:
      setVisible in class Dialog