>:<posted & mailed>
>:
[quoted text clipped - 18 lines]
>:What happens when you move pageDialog (or printDialog) on a screen?
>:Is it really moving or left marks of the dialog on other opened windows?
It sounds very much like you're displaying the pageDialog (or
printDialog) from within the actionPerformed method. But unless that
dialog is modal, so that it blocks (and the underlying Swing mechanisms
start a new event pump, etc., etc.), your Event Dispatching Thread will
be too busy to automatically redraw underlying windows/dialogs when you
move this page/print dialog. My app uses the printDialog() method of
PrinterJob, which would appear to block (it returns a boolean). If
true, it then calls the PrinterJob's print() method. And we're not
experiencing any problems of that type. But if this isn't working for
you, you may also want to consider whether you can spawn that section of
code into a separate thread.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Mario_5 - 07 Jan 2004 23:10 GMT
> >:<posted & mailed>
> >:
[quoted text clipped - 35 lines]
> Steve W. Jackson
> Montgomery, Alabama
I didn't understand exactely. How to call pageDialog which returns
PageFormat
except that I press the button whic calls :
public void actionPerformed(ActionEvent e) {
String label = e.getActionCommand();
if (label.equals("Print")) {
// Get a PrinterJob
job = PrinterJob.getPrinterJob();
// Create a landscape page format
// PageFormat format = new PageFormat();
PageFormat format = job.defaultPage();
format.setOrientation(PageFormat.LANDSCAPE);
papir = new Paper();
papir.setSize(12*72,2*72);
format = job.pageDialog(format);
// Set up a book
Book bk = new Book();
pageIndex=0;
bk.append(this, format);
// Pass the book to the PrinterJob
job.setPageable(bk);
if (job.printDialog()) {
// Print the job if the user didn't cancel printing
try { job.print(); }
catch (Exception exc) {
/* Handle Exception */
System.out.println("PrintGre?ka");
}
}
}
}
Steve W. Jackson - 08 Jan 2004 16:48 GMT
>:> In article <btejba$p5f$1@sunce.iskon.hr>, maRIO5 <mario_zupan@inet.hr>
>:> wrote:
[quoted text clipped - 74 lines]
>: }
>: }
Your code differs from the way I've done it mainly in that I don't use a
Book. But your call to pageDialog() does in fact return a PageFormat.
So far as I can tell, there's nothing in the code example here that
would block or take abnormally long to run. I'm not really familiar
with the use of Book or Paper classes, but I don't see any place where
you're using the Paper once you create it.
So the only further suggestion I might have to prevent this from bogging
your GUI is to put most of that code there into a separate Thread, maybe
building a Runnable around it and using SwingUtilities.invokeLater() so
that it will immediately free up the Event Dispatching Thread and let
your actionPerformed method return.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Mario_5 - 08 Jan 2004 18:01 GMT
> >:> In article <btejba$p5f$1@sunce.iskon.hr>, maRIO5 <mario_zupan@inet.hr>
> >:> wrote:
[quoted text clipped - 92 lines]
> Steve W. Jackson
> Montgomery, Alabama
And when you mentioned a Book, it isn't best solution for me.
I need to print some JTable separate on 4 pages for example.
I made print preview but now, I need to print on the same way on
four A4 format paper.
How to separate that table on 4 pages ?
Mario
Steve W. Jackson - 08 Jan 2004 18:53 GMT
>:> In article <bti3gj$7c8$1@sunce.iskon.hr>,
>:> "Mario_5" <mario_zupan@inet.hr> wrote:
[quoted text clipped - 110 lines]
>:
>:Mario
In our case, we've created a class that implements both Printable and
Pageable. In our app, there can be multiple "screens" of data, and each
one will print on a single page, regardless of actual size, by scaling
to fit. Instead, we could've calculated a copy of the "screen" in
multiple pieces to fit on separate pages -- perhaps based on user
settings or other details. We'll do that in some future release of our
product. But for your use, the most likely idea would be to capture the
contents of your JTable and begin studying exactly how the Printable
and/or Pageable interfaces work. My program creates a new instance of
that class I mentioned, then passes it to the PrinterJob via something
like a call to job.setPageable(myPageable) -- and it knows how to do the
work.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Andrew Thompson - 09 Jan 2004 00:56 GMT
...
| How to separate that table on 4 pages ?
How to make that reply in <4Kb?
Make use the 'delete' key to trim
old text. Please.