Class ImageCaptureManager

java.lang.Object
xal.tools.apputils.ImageCaptureManager

public class ImageCaptureManager extends Object
ImageCaptureManager manages the file chooser used to save image captures of the main window. All applications share the same default folder where the images are saved. This default folder is the last folder where a user saved an image.
Author:
tap
  • Field Details

    • YES_OPTION

      protected static final int YES_OPTION
      See Also:
    • NO_OPTION

      protected static final int NO_OPTION
      See Also:
    • fileChooser

      protected final JFileChooser fileChooser
      chooser for saving images
    • defaultFolderAccessory

      protected final DefaultFolderAccessory defaultFolderAccessory
      accessory for managing the default snapshot folder
  • Constructor Details

    • ImageCaptureManager

      protected ImageCaptureManager()
      Creates a new instance of ImageCaptureManager
  • Method Details

    • defaultManager

      public static ImageCaptureManager defaultManager()
      Get the default ImageCaptureManager instance.
      Returns:
      The default ImageCaptureManager instance.
    • getFileChooser

      public JFileChooser getFileChooser()
      Get the file chooser which determines where snapshots are saved.
      Returns:
      the image capture file chooser
    • saveSnapshot

      public void saveSnapshot(Component component) throws AWTException, IOException
      Save a snapshot of the component as a PNG image.
      Parameters:
      component - The component to capture.
      Throws:
      AWTException - If there is an AWT exception.
      IOException - If there is a file exception.
    • saveSnapshot

      public void saveSnapshot(Component component, String name) throws AWTException, IOException
      Save a snapshot of the component as a PNG image.
      Parameters:
      component - The component to capture.
      name - The snapshot name
      Throws:
      AWTException - If there is an AWT exception.
      IOException - If there is a file exception.
    • displayConfirmDialog

      public static int displayConfirmDialog(Component owner, String title, String message)
      Display a confirmation dialog with a title and message
      Parameters:
      owner - The component in front of which to show the dialog
      title - The title of the dialog
      message - The message to display
      Returns:
      YES_OPTION or NO_OPTION