JDK-4273333 : RFE: Let PrinterJob.printDialog dialog box be optionally modal
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.2,1.3.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-09-20
  • Updated: 2002-11-27
  • Resolved: 2000-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.3.1_03 03Fixed 1.4.0Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description

Name: krT82822			Date: 09/19/99


The dialog box shown by PrinterJob.printDialog is not modal and it should be. There is no option to make it modal even though most, if not all, applications will need it to be modal. Users with little knowledge may lose the dialog behind the browser window and not know how to get it back again.

public class Applet extends javax.swing.JApplet
    implements java.awt.print.Printable
{
    public void start()
    {
        java.awt.print.PrinterJob pjob = 
            java.awt.print.PrinterJob.getPrinterJob();
        pjob.setPrintable(this);
        if (pjob.printDialog())  // not modal, but needs to be
        {
            try
            {
                pjob.print();
            }
            catch (java.awt.print.PrinterException e)
            {
            }
        }
    }
    
    public int print(java.awt.Graphics g,
        java.awt.print.PageFormat pf,int index)
    {
        if (index <= 0)
        {
            return java.awt.print.Printable.PAGE_EXISTS;
        }
        return java.awt.print.Printable.NO_SUCH_PAGE;
    }
}
(Review ID: 93979) 
======================================================================

Failed in JDK1.4.1, JDK1.4.1_01 but it was fixed in merlin-beta so should be fixed in Hopper also.


###@###.### 2002-12-19

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.3.1_03 merlin-beta FIXED IN: 1.3.1_03 merlin-beta INTEGRATED IN: 1.3.1_03 merlin-beta
24-08-2004

EVALUATION I believe this is because we set the hWndOwner field to NULL because we don't have any easy way to make the association, and the Java API does not require a window to be associated with the dialog. implementing this seems to need new API Perhaps we could do this with a new Java (cross-platform) dialog or with the native dialog with a new API which allows a parent Window to be supplied which is taken to be the owner window. Incidentally the pageDialog has exactly the same issue as printDialog phil.race@eng 1999-09-20 ======================== Fix was putback in 1.3.1_03 and Merlin-beta. But the bug is still reproducible in hopper and mantis. Regression is caused in Hopper. The Suggested fix exists in Hopper . Even then its failing. Still needs to be investigated . ###@###.### 2002-11-25 This bug started to occur in 1.4.1 beta b06 but we have not made any change in dialog. Looks like AWT made some changes on focus - passing to AWT for investigation. ###@###.### 2002-11-26 Since it sounds like there may have been a regression of this fix in 1.4.1, I filed a new bug: 4785920. ###@###.### 2002-11-27
26-11-2002

SUGGESTED FIX src/win32/native/sun/windows/awt_PrintJob.cpp > #include "awt_Dialog.h" 527a529,531 > AwtDialog::ModalDisable(NULL); > BOOL ret = AwtPrintDialog::PageSetupDlg(&setup); > AwtDialog::ModalEnable(NULL); 529d532 < if (AwtPrintDialog::PageSetupDlg(&setup)) { 530a534,535 > if (ret) { > AwtDialog::ModalDisable(NULL); > BOOL ret = AwtPrintDialog::PrintDlg(&job); > AwtDialog::ModalEnable(NULL); > //AwtDialog::ModalNextWindowToFront(awtParent->GetHWnd()); > 654c677 < if (AwtPrintDialog::PrintDlg(&job)) { --- > if (ret) { ###@###.### 2002-11-25
25-11-2002