Other |
---|
5.0 b26Fixed |
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: yyT116575 Date: 09/26/2001 D:\inferno>java -version java version "1.3.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01) Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode) Calling printDialog() or pageDialog() on a java.awt.print.PrinterJob yields dialogs which when dragged do not trigger redraws of obscured Swing components of that application. This looks terrible. Additionally these dialogs should behave like normal modal dialogs but do not, i.e., they fall behind the application's window and don't block interactions with the application's frame. This testcase demonstrates the problem. In this example the main window is small, but keep in mind that in reality it would be a full application. Run the testcase and click on either the Print or Page Setup buttons and note the following bugs. Note that when either dialog comes up the main window no longer redraws as it should. Further note that the dialogs' modalities are strange--neither modal nor modaless. For example, the dialog is allowed to fall behind the main window and you can click on the main window's Minimize, Maximize and Close buttons. The correct behavior of Print and Page Setup dialogs (and of modal dialogs in general) is demonstrated in any Windows application, e.g., Notepad.exe. Note that in these applications modal dialogs are completely blocking but allow the application to continue to redraw its UI. /* * A testcase to demonstrate redraw problems caused by PrinterJob dialogs. */ package buggy; import java.awt.*; import java.awt.print.*; import java.awt.event.*; import javax.swing.*; public class Testcase extends JPanel { static JFrame m_frame; public Testcase() { JButton printBtn = new JButton("Print..."); JButton pageBtn = new JButton("Page Setup..."); printBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { PrinterJob job = PrinterJob.getPrinterJob(); job.printDialog(); } }); pageBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { PrinterJob job = PrinterJob.getPrinterJob(); job.pageDialog(job.defaultPage()); } }); add(printBtn, BorderLayout.CENTER); add(pageBtn, BorderLayout.CENTER); } public static void main(String str[]) { Testcase panel = new Testcase(); m_frame = new JFrame("Testcase"); m_frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);} }); m_frame.getContentPane().add("Center", panel); m_frame.setLocation(200, 200); panel.setPreferredSize(new Dimension(200, 200)); m_frame.pack(); m_frame.setVisible(true); } } (Review ID: 132605) ======================================================================
|