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)| Modifier and Type | Class and Description |
|---|---|
protected class |
PrintableComponent.JComponentWriterFileFilter
a specialized filter that also contains the associated filter class.
|
| Modifier and Type | Field and Description |
|---|---|
protected double |
m_AspectRatio
the aspect ratio.
|
protected static javax.swing.JCheckBox |
m_AspectRatioCheckBox
the checkbox for keeping the aspect ration.
|
protected javax.swing.JComponent |
m_Component
the parent component of this print dialog.
|
protected static javax.swing.JCheckBox |
m_CustomDimensionsCheckBox
the checkbox for the custom dimensions.
|
protected static javax.swing.JTextField |
m_CustomHeightText
the edit field for the custom height.
|
protected static javax.swing.JTextField |
m_CustomWidthText
the edit field for the custom width.
|
protected static javax.swing.JFileChooser |
m_FileChooserPanel
the filechooser for saving the panel.
|
protected boolean |
m_IgnoreChange
whether to ignore the update of the text field (in case of "keep ratio").
|
protected java.lang.String |
m_SaveDialogTitle
the title of the save dialog.
|
protected static boolean |
m_ShowToolTip
whether to display the tooltip or not.
|
protected static boolean |
m_ToolTipUserAsked
whether the user was already asked about the tooltip behavior.
|
protected double |
m_xScale
the x scale factor.
|
protected double |
m_yScale
the y scale factor.
|
protected static java.lang.String |
PROPERTY_SHOW
the property name for showing the tooltip.
|
protected static java.lang.String |
PROPERTY_USERASKED
the property name whether the user was already asked.
|
| 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. the key of the Hashtable is the description of the writer.
|
double |
getXScale()
returns the scale factor for the x-axis.
|
double |
getYScale()
returns the scale factor for the y-axis.
|
protected void |
initFileChooser()
initializes the filechooser, i.e. locates all the available writers in the
current package
|
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.
|
protected void |
updateDimensions(javax.swing.JTextField sender)
updates the dimensions if necessary (i.e., if aspect ratio is to be kept).
|
protected javax.swing.JComponent m_Component
protected static javax.swing.JFileChooser m_FileChooserPanel
protected static javax.swing.JCheckBox m_CustomDimensionsCheckBox
protected static javax.swing.JTextField m_CustomWidthText
protected static javax.swing.JTextField m_CustomHeightText
protected static javax.swing.JCheckBox m_AspectRatioCheckBox
protected java.lang.String m_SaveDialogTitle
protected double m_xScale
protected double m_yScale
protected double m_AspectRatio
protected boolean m_IgnoreChange
protected static boolean m_ToolTipUserAsked
protected static final java.lang.String PROPERTY_SHOW
protected static final java.lang.String PROPERTY_USERASKED
protected static boolean m_ShowToolTip
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 forprotected void initFileChooser()
protected void updateDimensions(javax.swing.JTextField sender)
sender - the JTextField which send the notification to updatepublic java.util.Hashtable<java.lang.String,JComponentWriter> getWriters()
getWriters in interface PrintableHandlerJComponentWriter.getDescription()public JComponentWriter getWriter(java.lang.String name)
null if not found.getWriter in interface PrintableHandlername - the name of the writerJComponentWriter.getDescription()public void setSaveDialogTitle(java.lang.String title)
setSaveDialogTitle in interface PrintableHandlertitle - the title of the save dialogpublic java.lang.String getSaveDialogTitle()
getSaveDialogTitle in interface PrintableHandlerpublic void setScale(double x,
double y)
setScale in interface PrintableHandlerx - the scale factor for the x-axisy - the scale factor for the y-axispublic double getXScale()
getXScale in interface PrintableHandlerpublic double getYScale()
getYScale in interface PrintableHandlerpublic void saveComponent()
getSelectedFile method returns
null instead of the filename.saveComponent in interface PrintableHandler