loci.formats.gui

## Class GUITools

- java.lang.Object
- - loci.formats.gui.GUITools

-     public final class GUITools
      extends java.lang.Object

  A utility class for working with graphical user interfaces.
  Author:
    Curtis Rueden ctrueden at wisc.edu

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static java.lang.String` | `ALL_TYPES` String to use for "all types" combination filter.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `GUITools()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static javax.swing.JFileChooser` | `buildFileChooser(javax.swing.filechooser.FileFilter[] filters)` Builds a file chooser with the given file filters, as well as an "All supported file types" combo filter.
    `static javax.swing.JFileChooser` | `buildFileChooser(javax.swing.filechooser.FileFilter[] filters, boolean preview)` Builds a file chooser with the given file filters, as well as an "All supported file types" combo filter, if one is not already specified.
    `static javax.swing.JFileChooser` | `buildFileChooser(IFormatHandler handler)` Constructs a file chooser for the given file format handler.
    `static javax.swing.JFileChooser` | `buildFileChooser(IFormatHandler handler, boolean preview)` Constructs a file chooser for the given file format handler.
    `static javax.swing.filechooser.FileFilter[]` | `buildFileFilters(IFormatHandler handler)` Constructs a list of file filters for the given file format handler.
    `private static javax.swing.filechooser.FileFilter` | `makeComboFilter(javax.swing.filechooser.FileFilter[] filters)` Creates an "All supported file types" combo filter encompassing all of the given filters.
    `private static void` | `shuffleAllTypesToFront(javax.swing.filechooser.FileFilter[] filters)` Looks for an "All supported file types" combo filter and shuffles it to the front of the list.
    `private static javax.swing.filechooser.FileFilter[]` | `sortFilters(javax.swing.filechooser.FileFilter[] filters)` Sorts the given list of file filters, keeping the "All supported file types" combo filter (if any) at the front of the list.
    `private static javax.swing.filechooser.FileFilter[]` | `sortFilters(java.util.Vector filterList)` Sorts the given list of file filters, keeping the "All supported file types" combo filter (if any) at the front of the list.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ALL_TYPES

          private static final java.lang.String ALL_TYPES

      String to use for "all types" combination filter.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GUITools

          private GUITools()

  - ### Method Detail

    - #### buildFileFilters

          public static javax.swing.filechooser.FileFilter[] buildFileFilters(IFormatHandler handler)

      Constructs a list of file filters for the given file format handler.

    - #### buildFileChooser

          public static javax.swing.JFileChooser buildFileChooser(IFormatHandler handler)

      Constructs a file chooser for the given file format handler.

    - #### buildFileChooser

          public static javax.swing.JFileChooser buildFileChooser(IFormatHandler handler,
                                                                  boolean preview)

      Constructs a file chooser for the given file format handler. If preview flag is set, chooser has an preview pane showing a thumbnail and other information for the selected file.

    - #### buildFileChooser

          public static javax.swing.JFileChooser buildFileChooser(javax.swing.filechooser.FileFilter[] filters)

      Builds a file chooser with the given file filters, as well as an "All supported file types" combo filter.

    - #### buildFileChooser

          public static javax.swing.JFileChooser buildFileChooser(javax.swing.filechooser.FileFilter[] filters,
                                                                  boolean preview)

      Builds a file chooser with the given file filters, as well as an "All supported file types" combo filter, if one is not already specified.
      Parameters:
        `preview` - If set, chooser has a preview pane showing a thumbnail and other information for the selected file.

    - #### makeComboFilter

          private static javax.swing.filechooser.FileFilter makeComboFilter(javax.swing.filechooser.FileFilter[] filters)

      Creates an "All supported file types" combo filter encompassing all of the given filters.

    - #### sortFilters

          private static javax.swing.filechooser.FileFilter[] sortFilters(javax.swing.filechooser.FileFilter[] filters)

      Sorts the given list of file filters, keeping the "All supported file types" combo filter (if any) at the front of the list.

    - #### sortFilters

          private static javax.swing.filechooser.FileFilter[] sortFilters(java.util.Vector filterList)

      Sorts the given list of file filters, keeping the "All supported file types" combo filter (if any) at the front of the list.

    - #### shuffleAllTypesToFront

          private static void shuffleAllTypesToFront(javax.swing.filechooser.FileFilter[] filters)

      Looks for an "All supported file types" combo filter and shuffles it to the front of the list.

Copyright © 2026 Open Microscopy Environment