类 JPEGWriter


public class JPEGWriter extends JComponentWriter
This class takes any JComponent and outputs it to a JPEG-file. Scaling is by default disabled, since we always take a screenshot.
版本:
$Revision: 7059 $
作者:
FracPete (fracpete at waikato dot ac dot nz)
  • 构造器详细资料

    • JPEGWriter

      public JPEGWriter()
      initializes the object.
    • JPEGWriter

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

      public JPEGWriter(JComponent c, File f)
      initializes the object with the given Component and filename.
      参数:
      c - the component to print in the output format
      f - the file to store the output in
  • 方法详细资料

    • 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.
      指定者:
      getDescription 在类中 JComponentWriter
      返回:
      the name of the writer
    • getExtension

      public String getExtension()
      returns the extension (incl. ".") of the output format, to use in the FileChooser. must be overridden in the derived class.
      指定者:
      getExtension 在类中 JComponentWriter
      返回:
      the file extension
    • getBackground

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

      public void setBackground(Color c)
      sets the background color to use in creating the JPEG.
      参数:
      c - the color to use for background
    • getQuality

      public float getQuality()
      returns the quality the JPEG will be stored in.
      返回:
      the quality
    • setQuality

      public void setQuality(float q)
      sets the quality the JPEG is saved in.
      参数:
      q - the quality to use
    • generateOutput

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

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