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
[Originally posted by kashiram99]

I am unable to get a Landscape print of
my JTable.I am using the printpreview class
from 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:
in the public int print(Graphics pg, PageFormat pageFormat,

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

I modified the from
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();
System.out.println("pageformat style "+pf.getOrientation());
prnJob.setPrintable(m_target, pf);
if (!prnJob.printDialog())



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

Kashi Ram<>