Dear All,
I am implementing a small text editor program, using
JTextArea
. The program has PageSetup and Print menu items.
The PageSetup menu item handler is given below and is working. Meaning if I do a PageSetup and change the page options like Landscape to portrait etc, the changes are checked to be retained when I enter PageSetup again, as pageFormat retains them.
// instance variable
PageFormat pageFormat = printerJob.defaultPage();
// handler code
void filePageSetupHandler( ActionEvent ae ) {
pageFormat=printerJob.pageDialog(pageFormat);
}
However, how do I use the pageFormat obtained in the above handler to implement the Print handler? I have tried various things, but no suceess. Here is the partially completed Print handler code.
void filePrintHandler( ActionEvent ae ) {
// how do I use the pageFormat information obtained earlier, in this place???
textArea.print(null,null,true,null,null,true);
}
Any help will be greatly appreciated.
Regards,
Sudheendran T L