Screen painting problems with PrinterJob.printDialog()

Hi,

I'm a Computing undergraduate who's new to Swing and AWT, and have come across a problem using the printDialog() method in PrinterJob (under Windows - JDK 1.3.1).

When the method is called to display the standard Windows Print Dialogue, the menu (JMenu) seems to get stuck on screen until the dialogue is dismissed. Also, grabbing the Printer dialogue by it's title bar and moving it around paints over everything beneath. Incidentally, I don't encounter the same problem when running the program under Linux (JDK 1.2.2).

Thanks in advance,

Martin

[593 byte] By [romania1] at [2007-9-26 2:10:20]
# 1
did you try launching it in a new thread, and in the Thread's constructor, set the priority of the thread to low (say setPriority(1))?
artntek at 2007-6-29 9:01:04 > top of Java-index,Archived Forums,Swing...
# 2

so you'd have:

class PrinterThread extends Thread{

//constructor

public PrinterThread(){

setPriority(1);

}

public void run(){

//start your printer dialog here...

}

}

//then in your code:

Thread printerThread = new PrinterThread();

printerThread.start();

artntek at 2007-6-29 9:01:04 > top of Java-index,Archived Forums,Swing...
# 3

> so you'd have:

> class PrinterThread extends Thread{

>

> //constructor

> public PrinterThread(){

> setPriority(1);

> }

>

> public void run(){

> //start your printer dialog here...

> }

> }

>

> //then in your code:

> Thread printerThread = new PrinterThread();

> printerThread.start();

Thanks - this works perfectly. I'd hadn't considered the use of threads before.

Martin

romania1 at 2007-6-29 9:01:04 > top of Java-index,Archived Forums,Swing...