Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  printDialog issue  (Read 745 times)
0 Members and 1 Guest are viewing this topic.
Offline jayhg99

JGO n00b
*

Posts: 49


Java games rock!


« on: 2003-05-13 09:53:17 »

Do not know if this is the right place to post it. But I have non game related issue:

Is there a way to associate printDialog with a frame ? It appears that when I drag the print dialog across the screen, the screen gets repainted by the print dialog
and the application focus is lost.

public class ex5 extends JComponent implements Printable, MouseMotionListener,ActionListener,MouseListener
{
....
protected JFrame frame;

public ex5(JFrame frame)
{
this.frame=frame;
}

.....

public void printImage()
{

PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);
if (printJob.printDialog())
{
try {
printJob.print();
} catch (Exception ex)
{
ex.printStackTrace();
}
}
}
}

I know that PrintJob class allow you to issue getPrintJob with specified frame such as:

PrintJob printJob = Toolkit.getDefaultToolkit().getPrintJob(frame, "Hello World", printprefs);

But how can I specify a frame for printDialog ?  The printing samples in Java tutorial have
the same issue. The samples can be found at http://java.sun.com/docs/books/tutorial/2d/printing/overview.html

If you drag the printDialog, the screen will get painted by the printDialog.


Thanks


Jay


Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.097 seconds with 20 queries.