Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4314606

JFileChooser should allow for an editable filter JComboBox.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 1.2.2
    • client-libs
    • None


      The attached source code and script implement a JFileChooser with an editable
      filter JComboBox. The editable filter that the sample program demonstrates
      is one that uses regular-expressions; it should be pretty close to the regular
      expression filter used in Solaris Motif-based tools.

      The main problem with the solution is that it is in the metal look-and-feel.
      Windows, Motif, and Mac look-and-feels are not implemented. For legal reasons,
      this is true in general - any developer could do what I have done and no more.

      The program consists of three files that implement the regular expression
      filter and a driver program:
        src/FileChooserDemo.java
        src/RegularFileFilter.java
        src/RegularFileFilterFactory.java
      There are two files that contain modifications of swing classes. The base
      for the modifications is JDK 1.2.
        src/javax/swing/JFileChooser.java
        src/javax/swing/plaf/metal/MetalFileChooserUI.java
      There is one file that would represent an addition to swing. It is an
      interface.
        src/javax/swing/filechooser/FileFilterFactory.java

      The modifications to the swing classes were made to be backwards compatible.
      No program whatsoever will be affected.

      To run the sample, unpack the jar file and the script X.ksh so that X.ksh
      and the "src" directory are side by side. Set JAVA_HOME and then
      execute X.ksh.

      allan.jacobs@Eng 2000-02-22

      During the course of our work testing Java it was discovered that MKS's ksh has
      some bugs and deficiencies that prevent our scripts from running on NT. The
      immediate response was why were we using ksh scripting - why not use Java?
      One reason is that tools like sed and grep are missing. The hardest part of these
      is the regular expression handling. It took 48 hours for me to remember that I
      had already written regular expression code.

      So - my original attachment in this bug is misdesigned - there should be a
      RegularExpression class that can be used outside of a JFileChooser. Check out
      attachments X2.ksh and FChooser2.jar. The code is better commented now, too.

      allan.jacobs@Eng 2000-03-13

      The attachment changed. You, as a user, can chooser between using FileNamePattern
      (used in the Motif Filechooser) and BasicRegularExpression (man -s 5 regexp).
      There is an internationalized version of regular expressions in Unix (man -s 5 regex).

      I could not understand the documentation for regex, so it has not been implemented.
      Regex and regexp differ in what they claim is a Basic Regular Expression, so it
      is possible that my implementation of BasicRegularExpression is in error. One difference
      is whether or not the asterisk operator applies to REs enclosed in parentheses.
      The other is whether or not the asterisk operator applies to backward references
      (\1, \2, ...). This is too bad, because lack of internationalization is one of the
      weaknesses of the expression classes implemented here.

      That's the last change from my quarter - unless you feel that there should be an RFE
      requesting that Unix regular expression classes be supported in the class library.
      I'm agnostic on this. The pro side is that they would help in writing Java versions of
      familiar command line utilities and could be used in JFileChoosers. The con sides are
      the lack of internationalization and that there are likely to be OS differences that
      these classes run roughshod over,

      allan.jacobs@Eng 2000-04-03

            leifs Leif Samuelsson (Inactive)
            ajacobssunw Allan Jacobs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: