weka.gui.visualize
Class JPEGWriter

java.lang.Object
  extended by weka.gui.visualize.JComponentWriter
      extended by 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: 1.1.2.1 $
Author:
FracPete (fracpete at waikato dot ac dot nz)
See Also:
#setScalingEnabled()

Constructor Summary
JPEGWriter()
          initializes the object
JPEGWriter(javax.swing.JComponent c)
          initializes the object with the given Component
JPEGWriter(javax.swing.JComponent c, java.io.File f)
          initializes the object with the given Component and filename
 
Method Summary
 java.awt.Color getBackground()
          returns the current background color
 java.lang.String getDescription()
          returns the name of the writer, to display in the FileChooser.
 java.lang.String getExtension()
          returns the extension (incl.
 float getQuality()
          returns the quality the JPEG will be stored in
 void initialize()
          further initialization
static void main(java.lang.String[] args)
          for testing only
 void setBackground(java.awt.Color c)
          sets the background color to use in creating the JPEG
 void setQuality(float q)
          sets the quality the JPEG is saved in
 void toOutput()
          saves the current component to the currently set file
static void toOutput(javax.swing.JComponent c, java.io.File f)
          outputs the given component as JPEG in the specified file
 
Methods inherited from class weka.gui.visualize.JComponentWriter
getComponent, getFile, getScalingEnabled, getXScale, getYScale, setComponent, setFile, setScale, setScalingEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGWriter

public JPEGWriter()
initializes the object


JPEGWriter

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

Parameters:
c - the component to print in the output format

JPEGWriter

public JPEGWriter(javax.swing.JComponent c,
                  java.io.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 Detail

initialize

public void initialize()
further initialization


getDescription

public java.lang.String getDescription()
returns the name of the writer, to display in the FileChooser. must be overridden in the derived class.

Overrides:
getDescription in class JComponentWriter

getExtension

public java.lang.String getExtension()
returns the extension (incl. ".") of the output format, to use in the FileChooser. must be overridden in the derived class.

Overrides:
getExtension in class JComponentWriter

getBackground

public java.awt.Color getBackground()
returns the current background color


setBackground

public void setBackground(java.awt.Color c)
sets the background color to use in creating the JPEG


getQuality

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


setQuality

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


toOutput

public static void toOutput(javax.swing.JComponent c,
                            java.io.File f)
                     throws java.lang.Exception
outputs the given component as JPEG in the specified file

Parameters:
c - the component to output as PS
f - the file to store the PS in
Throws:
java.lang.Exception - if component of file are null

toOutput

public void toOutput()
              throws java.lang.Exception
saves the current component to the currently set file

Overrides:
toOutput in class JComponentWriter
Throws:
java.lang.Exception - if component of file are null

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
for testing only

Throws:
java.lang.Exception