public class PrintableComponent extends 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(JComponent component)
initializes the panel.
|
Modifier and Type | Method and Description |
---|---|
JComponent |
getComponent()
returns the GUI component this print dialog is part of.
|
String |
getSaveDialogTitle()
returns the title for the save dialog.
|
static String |
getToolTipText(PrintableComponent component)
Returns a tooltip only if the user wants it.
|
JComponentWriter |
getWriter(String name)
returns the JComponentWriter associated with the given name, is
null if not found. |
Hashtable |
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(String title)
sets the title for the save dialog.
|
void |
setScale(double x,
double y)
sets the scale factor.
|
public PrintableComponent(JComponent component)
component
- the component to enhance with printing functionalitypublic JComponent getComponent()
public static String getToolTipText(PrintableComponent component)
component
- the PrintableComponent to ask forpublic Hashtable getWriters()
getWriters
in interface PrintableHandler
JComponentWriter.getDescription()
public JComponentWriter getWriter(String name)
null
if not found.getWriter
in interface PrintableHandler
name
- the name of the writerJComponentWriter.getDescription()
public void setSaveDialogTitle(String title)
setSaveDialogTitle
in interface PrintableHandler
title
- the title of the save dialogpublic 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
Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.