Package jexer

Class TFileOpenBox

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TFileOpenBox
    extends TWindow
    TFileOpenBox is a system-modal dialog for selecting a file to open. Call it like:
     
         filename = fileOpenBox("/path/to/file.ext",
             TFileOpenBox.Type.OPEN);
         if (filename != null) {
             ... the user selected a file, go open it ...
         }
     
     
    • Constructor Detail

      • TFileOpenBox

        public TFileOpenBox​(TApplication application,
                            java.lang.String path,
                            TFileOpenBox.Type type)
                     throws java.io.IOException
        Public constructor. The file open box will be centered on screen.
        Parameters:
        application - the TApplication that manages this window
        path - path of selected file
        type - one of the Type constants
        Throws:
        java.io.IOException - of a java.io operation throws
      • TFileOpenBox

        public TFileOpenBox​(TApplication application,
                            java.lang.String path,
                            TFileOpenBox.Type type,
                            java.util.List<java.lang.String> filters)
                     throws java.io.IOException
        Public constructor. The file open box will be centered on screen.
        Parameters:
        application - the TApplication that manages this window
        path - path of selected file
        type - one of the Type constants
        filters - a list of strings that files must match to be displayed
        Throws:
        java.io.IOException - of a java.io operation throws
    • Method Detail

      • onKeypress

        public void onKeypress​(TKeypressEvent keypress)
        Handle keystrokes.
        Overrides:
        onKeypress in class TWindow
        Parameters:
        keypress - keystroke event
      • draw

        public void draw()
        Draw me on screen.
        Overrides:
        draw in class TWindow
      • getFilename

        public java.lang.String getFilename()
        Get the return string.
        Returns:
        the filename the user selected, or null if they canceled.