Re: Sorting JFileChooser



Andrey, you are correct! Only instead of override it to do nothing, I
have it do my special sort and then leave FileSystemView alone. It's
funny how many threads on this issue point people towards that class
but all sorting done on the getFiles method is completely redone in the
BasicDirectoryModel. What I am trying to override the sort method, but
it's not easy.

here are my steps. I'll post if it works.

1. Extend BasicDirectoryModel to CustomSortBasicDirectoryModel and
override sort(Vector v) to get the sorting I desire.
2. Extend BasicFileChooserUI to CustomSortBasicFileChooserUI and
override getModel() to return CustomSortBasicFileModel.
3. Call setUI(myCustomSortBasicFileChooserUI) in the
JFileChooserDialog. Hopefully the UpdateUI method isn't called
indirectly on the JFileChooser or else I'll have to extend and override
that method also.


..... Swing is a pain in my ass. I will post if it works.

.



Relevant Pages

  • Re: Sorting JFileChooser
    ... Extend BasicDirectoryModel to CustomSortBasicDirectoryModel and ... override getModel() to return CustomSortBasicFileModel. ... a different Comparator or redefine the natural sort order of the elts ...
    (comp.lang.java.gui)
  • Re: Interposer classes
    ... > and BeforeApplyUpdate events. ... When you extend a class you do not "override an event", ... method as well that fires the BeforeApplyUpdate event. ...
    (borland.public.delphi.language.objectpascal)
  • Re: operator overloading
    ... If you do not have trust in the author, then extend the library class and override the method with your own implementation. ... If these are static utility methods they will not be overridable. ... The usual and best reaction to an untrustworthy API is not to extend it, trying to make a silk purse out of a sow's ear, but to abandon it in favor of one that works. ...
    (comp.lang.java.programmer)
  • Re: Ducktator - A Duck Type Validator
    ... } To extend Austin's point a little: In ruby, it really has to be this} way. ... it is the developer's responsibility to override respond_to? ... instance_methods list so that reflection works as expected. ...
    (comp.lang.ruby)
  • Re: new python syntax: concatenation of functions
    ... what you would *really* like to do, is to be able to extend any class, and ... override it's operators. ...
    (comp.lang.python)