Cloners :
|
|
Cloners :
|
|
Duplicate :
|
FULL PRODUCT VERSION : java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode) ADDITIONAL OS VERSION INFORMATION : 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 A DESCRIPTION OF THE PROBLEM : Wrong icon in modal alerts created using JOptionPane. If creating a modal dialog using JOptionPane and using the message types: warning, information, question or error. Then the icon used is a folder icon and not a icon representing applications. When using information or question message types, the problem is acute as only the folder icon is used REGRESSION. Regression from Apple's Java 6uX STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : a) Launch the attached code snipped and look at the icons used in the modal alerts displayed. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Application icons used in modal alerts as background for modal dialog alert icon ACTUAL - Folder icons used in modal alerts as background for modal dialog alert icon REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.Point; import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class MAlertIconBugReport { private static String messageTypeToString(final int messageType) { switch (messageType) { case JOptionPane.ERROR_MESSAGE: return "Error message"; case JOptionPane.INFORMATION_MESSAGE: return "Information message"; case JOptionPane.WARNING_MESSAGE: return "Warning message"; case JOptionPane.QUESTION_MESSAGE: return "Question message"; case JOptionPane.PLAIN_MESSAGE: return "Plain message"; default: return "Unknown message type: " + messageType; } } /** * Offset of placing of modal dialogs */ private static int offset = 0; public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { for (final Integer messageType : new Integer[] {JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE, JOptionPane.WARNING_MESSAGE, JOptionPane.QUESTION_MESSAGE, JOptionPane.PLAIN_MESSAGE}) { /** * Need to put the modal dialog creation into a <code>Runnable</code> to * prevent the <code>setVisible</code> call from blocking the <code>for</code> * loop */ SwingUtilities.invokeLater(new Runnable() { public void run() { final JOptionPane optionPane = new JOptionPane(messageTypeToString(messageType), messageType); final JDialog dialog = optionPane.createDialog("Hello world!"); dialog.pack(); dialog.setLocationRelativeTo(null); /** * Nudge the position of the modal dialog to make the other * modal dialogs visible */ final Point location = dialog.getLocation(); dialog.setLocation(location.x + offset, location.y + offset); offset += 25; dialog.setVisible(true); } }); } } }); } } ---------- END SOURCE ----------