Package weka.gui.visualize
Class PNGWriter
java.lang.Object
weka.gui.visualize.JComponentWriter
weka.gui.visualize.PNGWriter
This class takes any JComponent and outputs it to a PNG-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 Summary
ConstructorDescriptioninitializes the object.initializes the object with the given Component.PNGWriter
(JComponent c, File f) initializes the object with the given Component and filename. -
Method Summary
Modifier and TypeMethodDescriptionvoid
generates the actual output.returns the current background color.returns the name of the writer, to display in the FileChooser.returns the extension (incl.void
further initialization.static void
for testing only.void
sets the background color to use in creating the PNG.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
-
Constructor Details
-
PNGWriter
public PNGWriter()initializes the object. -
PNGWriter
initializes the object with the given Component.- Parameters:
c
- the component to print in the output format
-
PNGWriter
initializes the object with the given Component and filename.- Parameters:
c
- the component to print in the output formatf
- the file to store the output in
-
-
Method Details
-
initialize
public void initialize()further initialization. -
getDescription
returns the name of the writer, to display in the FileChooser. must be overridden in the derived class.- Specified by:
getDescription
in classJComponentWriter
- Returns:
- the name of the writer
-
getExtension
returns the extension (incl. ".") of the output format, to use in the FileChooser.- Specified by:
getExtension
in classJComponentWriter
- Returns:
- the file extension
-
getBackground
returns the current background color.- Returns:
- the current background color
-
setBackground
sets the background color to use in creating the PNG.- Parameters:
c
- the color to use for background
-
generateOutput
generates the actual output.- Throws:
Exception
- if something goes wrong
-
main
for testing only.- Parameters:
args
- the commandline arguments- Throws:
Exception
- if something goes wrong
-