public class PrintableComponent extends java.lang.Object implements PrintableHandler
The individual JComponentWriter-descendants can be accessed by the
getWriter(String)
method, if the parameters need to be changed.
getWriters()
,
getWriter(String)
Constructor and Description |
---|
PrintableComponent(javax.swing.JComponent component)
initializes the panel.
|
Modifier and Type | Method and Description |
---|---|
javax.swing.JComponent |
getComponent()
returns the GUI component this print dialog is part of.
|
java.lang.String |
getSaveDialogTitle()
returns the title for the save dialog.
|
static java.lang.String |
getToolTipText(PrintableComponent component)
Returns a tooltip only if the user wants it.
|
JComponentWriter |
getWriter(java.lang.String name)
returns the JComponentWriter associated with the given name, is
null if not found. |
java.util.Hashtable<java.lang.String,JComponentWriter> |
getWriters()
returns a Hashtable with the current available JComponentWriters in the
save dialog.
|
double |
getXScale()
returns the scale factor for the x-axis.
|
double |
getYScale()
returns the scale factor for the y-axis.
|
void |
saveComponent()
displays a save dialog for saving the panel to a file.
|
void |
setSaveDialogTitle(java.lang.String title)
sets the title for the save dialog.
|
void |
setScale(double x,
double y)
sets the scale factor.
|
public PrintableComponent(javax.swing.JComponent component)
component
- the component to enhance with printing functionalitypublic javax.swing.JComponent getComponent()
public static java.lang.String getToolTipText(PrintableComponent component)
component
- the PrintableComponent to ask forpublic java.util.Hashtable<java.lang.String,JComponentWriter> getWriters()
getWriters
in interface PrintableHandler
JComponentWriter.getDescription()
public JComponentWriter getWriter(java.lang.String name)
null
if not found.getWriter
in interface PrintableHandler
name
- the name of the writerJComponentWriter.getDescription()
public void setSaveDialogTitle(java.lang.String title)
setSaveDialogTitle
in interface PrintableHandler
title
- the title of the save dialogpublic java.lang.String getSaveDialogTitle()
getSaveDialogTitle
in interface PrintableHandler
public void setScale(double x, double y)
setScale
in interface PrintableHandler
x
- the scale factor for the x-axisy
- the scale factor for the y-axispublic double getXScale()
getXScale
in interface PrintableHandler
public double getYScale()
getYScale
in interface PrintableHandler
public void saveComponent()
getSelectedFile
method returns
null
instead of the filename.saveComponent
in interface PrintableHandler