爪哇(本机)打印对话框 - 更改图标 [英] Java (native) print dialog - change icon

查看:175
本文介绍了爪哇(本机)打印对话框 - 更改图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 PrinterJob.printDialog()来让用户选择打印机和更改各种打印设置。

I use PrinterJob.printDialog() to let the user select a printer and change various print settings.

不过使用标准Java的CoffeeCup图标,而不是一个来自我的主窗口(JFrame的)总是显示在对话框

However the dialog is always displayed using the standard Java coffeecup icon and not the one from my main window (JFrame).

我怎样才能更改该对话框中的图标?

How can I change the icon for that dialog?

我用下面这段code的:

I'm using the following piece of code:


PrinterJob pj = PrinterJob.getPrinterJob(); 
pj.printDialog(); // how do I change the icon for the dialog that is displayed here

... // process the selection from the dialog

通常一个JDialog继承父的JFrame的图标,但在这种情况下,我无法通过或指定父窗口为该对话框

Normally a JDialog inherits the icon from the "parent" JFrame, but in this case I cannot pass or specify a parent window for that dialog

我使用的Java6

推荐答案

似乎a_horse_with_no_name会卡住(像我们其余的人)与没有自定义图标的打印对话框。 : - )

It seems that a_horse_with_no_name will be stuck (like the rest of us) with a print dialog with no custom icon. :-)

甚至出现的iReport的打印对话框与标准咖啡杯图标。打印对话框没有表现得像JFileChooser中JColorChooser的或。幸运的是模态。

Even iReport's print dialog appears with the standard coffee-cup icon. Print dialog does not behave like JFileChooser or JColorChooser. Fortunately it is modal.

如果该图标打扰你太多,你可以创建它周围的包装类,并制定出细节你喜欢的方式。

If the icon bothers you too much, you could create a wrapper class around it, and work out the details the way you like.

的Java6 API不提供修改图标的方式。我将与咖啡杯住了一段时间,将等待JDK的下一个版本,可能会提供类似的JFileChooser行为。

Java6 API offers no way of modifying the icon. I will live with the coffee-cup for a while and will wait for the next version of the JDK that may offer a behaviour like JFileChooser.

这篇关于爪哇(本机)打印对话框 - 更改图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆