JDK-7158366 : [macosx] Print-to-file dialog doesn't have an entry field for a name
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7,7u4,7u40,8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2012-04-02
  • Updated: 2013-06-15
  • Resolved: 2012-06-27
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.
JDK 7 JDK 8
7u40Fixed 8 b45Fixed
Description
Mac OS X 10.7.3 macmini4,1

Try to run closed/java/awt/print/Dialog/PrintDlgApp.java test. It is broken and not runs as a jtreg test but OK as a main application.

It will show a print dialog with Print to File option selected. Click Print: you will see a file chooser dialog without an option to examine, change, or enter a filename.

Comments
mac10.8.2-x64 8b71(64bit) sun/security/tools/policytool/i18n.sh It has same issue,there is no filename field.
09-01-2013

mac10.8.2-x64 7u12b05(64bit) sun/security/tools/policytool/i18n.sh It has same issue: there is no filename field.refer to i18n.jpg
08-01-2013

EVALUATION I like setting the SAVE_DIALOG type in the printing code, since printing to file always needs the file name
10-04-2012

EVALUATION I think I see the problem. JFileChooser defaults to being an "Open" dialog. Printing needs to use it as a "Save" dialog so you can create the new file. Metal and I guess Windows L&F always show the editable file name field, so its not mattered. Aqua seems to be quite different in this regard. I can fix it in printing code by adding jfc.setDialogType(JFileChooser.SAVE_DIALOG); I don't think this will cause any new problems. I do not have a definite explanation why this was not a problem in Apple JDK6 other than to speculate that since this afflicted Apple users that it was fixed in ServiceDialog.java there but never made it back to us or into the JDK 7 OS X port code ???
09-04-2012

EVALUATION I assigned it back to get more information from the 2d side: How does the test case provided in the previous post connect with the desribed bug? The FC test hangs on my machine when I run it, however if I wrap it with Runnable and invoke it on EDT the dialog is shown as expected. import javax.swing.*; import java.io.*; public class FC { public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFileChooser jfc = new JFileChooser(); jfc.setSelectedFile(new File("foo.txt")); jfc.setApproveButtonText("Print"); jfc.setDialogTitle("Print to file"); jfc.showDialog(null, null); } }); } } The sun.print.ServiceDialog seems to be driven by the various settings so it is not clear if this is a Swing problem Feel free to reassign it back
09-04-2012

EVALUATION This seems to be a generic problem with the Swing file chooser likely specific to Aqua. Printing just happens to use that dialog/chooser. It does seem to be a regression as it was OK with JDK6 Just run this program : import java.io.*; import javax.swing.*; public class FC { public static void main(String args[]) { JFileChooser jfc = new JFileChooser(); jfc.setSelectedFile(new File("foo.txt")); jfc.setApproveButtonText("Print"); jfc.setDialogTitle("Print to file"); jfc.showDialog(null, null); } }
05-04-2012