Class BMPWriter


public class BMPWriter extends JComponentWriter
This class takes any JComponent and outputs it to a BMP-file. Scaling is by default disabled, since we always take a screenshot.
Version:
$Revision: 8034 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
  • Constructor Details

    • BMPWriter

      public BMPWriter()
      initializes the object.
    • BMPWriter

      public BMPWriter(JComponent c)
      initializes the object with the given Component.
      Parameters:
      c - the component to print in the output format
    • BMPWriter

      public BMPWriter(JComponent c, File f)
      initializes the object with the given Component and filename.
      Parameters:
      c - the component to print in the output format
      f - the file to store the output in
  • Method Details

    • initialize

      public void initialize()
      further initialization.
    • getDescription

      public String getDescription()
      returns the name of the writer, to display in the FileChooser. must be overridden in the derived class.
      Specified by:
      getDescription in class JComponentWriter
      Returns:
      the name of the writer
    • getExtension

      public String getExtension()
      returns the extension (incl. ".") of the output format, to use in the FileChooser.
      Specified by:
      getExtension in class JComponentWriter
      Returns:
      the file extension
    • getBackground

      public Color getBackground()
      returns the current background color.
      Returns:
      the current background color
    • setBackground

      public void setBackground(Color c)
      sets the background color to use in creating the BMP.
      Parameters:
      c - the color to use for background
    • generateOutput

      public void generateOutput() throws Exception
      generates the actual output.
      Throws:
      Exception - if something goes wrong
    • main

      public static void main(String[] args) throws Exception
      for testing only.
      Parameters:
      args - the commandline arguments
      Throws:
      Exception - if something goes wrong