The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

This topic is READ ONLY
import-bot (20211) [Avatar] Offline
#1
[Originally posted by kashiram99]

Hello!
I am unable to get a Landscape print of
my JTable.I am using the printpreview class
from www.spindoczine.com chp22.
I have modified it to explicitly set the page format
to landscape but still i am not getting the req.
I have tried to use:
pageFormat.setOrientation(PageFormat.LANDSCAPE);
in the public int print(Graphics pg, PageFormat pageFormat,

int pageIndex) throws PrinterException method but still
getting the potrait print.

I modified the PrintPreview.java from
http://www.spindoczine.com/sbe/files/uts/chapter22html/chapter22.htm
as below :

JButton bt = new JButton("Print", new ImageIcon("print.gif"));

ActionListener lst = new ActionListener() {

public void actionPerformed(ActionEvent e) {

try {

// Use default printer, no dialog

PrinterJob prnJob = PrinterJob.getPrinterJob();

PageFormat pf = prnJob.defaultPage();
pf.setOrientation(PageFormat.LANDSCAPE);
System.out.println("pageformat style "+pf.getOrientation());
prnJob.setPrintable(m_target, pf);
prnJob.pageDialog(pf);
if (!prnJob.printDialog())

return;

prnJob.print();

But still futile.I am using JDK1.3
CAn anybody help me out

Thanks
Kashi Ram<kashiram99@yahoo.com>