Package weka.gui.visualize

# Class JPEGWriter

java.lang.Object
weka.gui.visualize.JComponentWriter
weka.gui.visualize.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.

Version:
  $Revision: 7059 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)

## Constructor Summary

Constructors
Constructor
Description
`JPEGWriter()`
initializes the object.
`JPEGWriter(JComponent c)`
initializes the object with the given Component.
`JPEGWriter(JComponent c, File f)`
initializes the object with the given Component and filename.

## Method Summary

Modifier and Type
Method
Description
`void`
`generateOutput()`
generates the actual output.
`Color`
`getBackground()`
returns the current background color.
`String`
`getDescription()`
returns the name of the writer, to display in the FileChooser.
`String`
`getExtension()`
returns the extension (incl.
`float`
`getQuality()`
returns the quality the JPEG will be stored in.
`void`
`initialize()`
further initialization.
`static void`
`main(String[] args)`
for testing only.
`void`
`setBackground(Color c)`
sets the background color to use in creating the JPEG.
`void`
`setQuality(float q)`
sets the quality the JPEG is saved in.

### Methods inherited from class weka.gui.visualize.JComponentWriter

`getComponent, getCustomHeight, getCustomWidth, getFile, getScalingEnabled, getUseCustomDimensions, getXScale, getYScale, setComponent, setCustomHeight, setCustomWidth, setFile, setScale, setScalingEnabled, setUseCustomDimensions, toOutput, toOutput, toOutput`

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

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

## Constructor Details

### JPEGWriter

public JPEGWriter()
initializes the object.

### JPEGWriter

public JPEGWriter(JComponent c)
initializes the object with the given Component.

Parameters:
  `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.

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. must be overridden in the derived class.

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 JPEG.

Parameters:
  `c` - the color to use for background

### getQuality

public float getQuality()
returns the quality the JPEG will be stored in.

Returns:
  the quality

### setQuality

public void setQuality(float q)
sets the quality the JPEG is saved in.

Parameters:
  `q` - the quality to use

### 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