Class PreviewPane

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, Runnable, EventListener, Accessible

public class PreviewPane extends JPanel implements PropertyChangeListener, Runnable
PreviewPane is a panel for use as a JFileChooser accessory, displaying a thumbnail for the selected image, loaded in a separate thread.
See Also:
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • reader

      protected BufferedImageReader reader
      Reader for use when loading thumbnails.
    • loadId

      protected String loadId
      Current ID to load.
    • lastId

      protected String lastId
      Last ID loaded.
    • loader

      protected Thread loader
      Thumbnail loading thread.
    • loaderAlive

      protected boolean loaderAlive
      Flag indicating whether loader thread should keep running.
    • refresher

      protected Runnable refresher
      Method for syncing the view to the model.
    • iconLabel

      protected JLabel iconLabel
      Labels containing thumbnail and dimensional information.
    • formatLabel

      protected JLabel formatLabel
      Labels containing thumbnail and dimensional information.
    • resLabel

      protected JLabel resLabel
      Labels containing thumbnail and dimensional information.
    • zctLabel

      protected JLabel zctLabel
      Labels containing thumbnail and dimensional information.
    • typeLabel

      protected JLabel typeLabel
      Labels containing thumbnail and dimensional information.
    • icon

      protected ImageIcon icon
    • iconText

      protected String iconText
    • formatText

      protected String formatText
    • resText

      protected String resText
    • zctText

      protected String zctText
    • typeText

      protected String typeText
    • iconTip

      protected String iconTip
    • formatTip

      protected String formatTip
    • resTip

      protected String resTip
    • zctTip

      protected String zctTip
    • typeTip

      protected String typeTip
  • Constructor Details

    • PreviewPane

      public PreviewPane(JFileChooser jc)
      Constructs a preview pane for the given file chooser.
  • Method Details

    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Property change event, to listen for when a new file is selected, or the file chooser closes.
      Specified by:
      propertyChange in interface PropertyChangeListener
    • run

      public void run()
      Thumbnail loading routine.
      Specified by:
      run in interface Runnable
    • close

      public void close() throws IOException
      Closes the underlying image reader.
      Throws:
      IOException
    • makeImage

      private BufferedImage makeImage(String message)
      Creates a blank image with the given message painted on top (e.g., a loading or error message), matching the size of the active reader's thumbnails.