简体   繁体   English

Java对话框弹出框中的随机图像

[英]Random Image in Java Dialog Popup Boxes

Random images keep appearing in all of my my Java popup boxes: The "inKeep editor" should not be there... the 'inkeep editor' image is a file called 'icon' and is used for the apple dock. 随机图像一直出现在all of my Java弹出框中:“ inKeep编辑器”不应该在其中……“ inkeep编辑器”图像是一个名为“ icon”的文件,用于Apple Dock。

String response = JOptionPane.showInputDialog(Home.toolbar, "Please confirm your password to make changes", "Confirm Password", JOptionPane.QUESTION_MESSAGE);

JOptionPane.showMessageDialog(Home.toolbar, "Wrong Password", "Verify Account", JOptionPane.ERROR_MESSAGE);

I'm setting this image as the dock icon (mac) but not for pop boxes (to my knowledge). 我将此图像设置为停靠图标(mac),但不设置弹出框(据我所知)。

Application application = Application.getApplication();
Image image = Toolkit.getDefaultToolkit().getImage("src/resources/icon.png"); // Sets apple icon image
application.setDockIconImage(image);

Does anyone know how to get rid of these images in the dialogs? 有谁知道如何消除对话框中的这些图像? The big red (!) is intended but not the inKeep editor over it. 大红色(!)是预期的,但不是inKeep编辑器。

This is the expected behavior -- a feature . 这是预期的行为-一个功能 When you give your application an icon, it will display it on top of the default warning/error icons. 当您为应用程序提供图标时,它将显示在默认警告/错误图标的顶部。 This reinforces with the user that the dialog that just popped up is from your application and not another or the OS. 这向用户增强了,刚弹出的对话框来自您的应用程序,而不是另一个或操作系统。

For example, here how it looks using the default Java app icon: 例如,下面是使用默认Java应用程序图标的外观:

在此处输入图片说明

To add a custom icon, you can do something like this: 要添加自定义图标,您可以执行以下操作:

ImageIcon icon = new ImageIcon(...);
JOptionPane.showMessageDialog(null, "", "", JOptionPane.ERROR_MESSAGE, icon);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM