Class FileField

    • Constructor Detail

      • FileField

        public FileField()
      • FileField

        public FileField​(ComboBoxModel pModel)
        Create a file field with an editable combo box (or JTextField if pModel is null). If it exists, model must contain only Strings.
        Parameters:
        pModel - combo box model listing files to appear in drop-down menu.
    • Method Detail

      • getField

        public JComponent getField()
        Field used for manual specification of filename (either a JFormattedTextField or a JComboBox). It is easy to prevent invalid file specifications by adding a property change listener as specified by the formatted text field API. Also, a user can be forced to choose a file using the file chooser by making this field non-editable.
      • getBrowseAction

        public SwingAction getBrowseAction()
        Action used to launch file chooser.
      • getFileChooser

        public JFileChooser getFileChooser()
        Dialog used to browse for a file or directory.
      • setFileChooser

        public void setFileChooser​(JFileChooser pFileChooser)
      • getText

        public String getText()
        Returns:
        Text of file field.
      • getFile

        public File getFile()
        Returns:
        File based on text. Empty string converts to null.
      • setText

        public void setText​(String pText)
        Set text of file field.
      • setFile

        public void setFile​(File pFile)
      • browse

        protected void browse()
      • main

        public static void main​(String[] pArgs)
        Display a dummy frame with a FileField in it.