It seems the QUESTION_MESSAGE icon when running on my Mac OS X box is either missing or has some other problem.
Let me start by describing my environment. I'm currently using Mac OS X 10.5.6. Under About This Mac, it shows I have JavaVM 12.2.2 installed. Given the version difference from PC, I wasn't entirely sure if Eclipse was using the same VM. Eclipse shows the selected Installed JRE as JVM 1.5.0 (MacOS X Default). However, 12.2.2 is the version that is shown in the default About window of my Swing applications launched from Eclipse, so I think it probably is. I don't quite understand how the versions work on Mac. If I type "java -version" from the terminal it shows version 1.5.0_16-b06-284.
Now on to the problem. The QUESTION_MESSAGE icon doesn't seem to match all the other JOptionPane icons for starters. Further indication of a problem comes when I set the system property to give my app a proper name in the application drop down menu, at which time I also get an error in the console and the dialog appears with no icon at all.
The error I get when the system property is set is as follows:
2009-02-25 20:03:49.053 java[6481:10b] *** CPerformer: ignoring exception 'Can't cache image' raised during perform of selector 'getDockIconImage:' on target '<ApplicationDelegate: 0x82def0>' with args '<>'
Can anyone else with Mac OS X try this out and see what the results are? Below is a sample app that demonstrates the problem on my machine.
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
public class IconFailure {
public static void main(String[] args) {
// if property is set, no icon is rendered for question message in JOptionPane
// if property is not set, a generic icon (dissimilar from the other JOptionPane icons)
// is rendered for question message in JOptionPane
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Icon Failure Test");
SwingUtilities.invokeLater(new Runnable() {
public void run() {
launch();
}
});
}
private static void launch() {
JFrame frame = new JFrame("Icon Failure");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
JOptionPane.showConfirmDialog(frame,
"Does the question icon appear?",
"Icon Failure Test", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
}
}
Thanks,
Scott
Edited by: Skotty on Feb 26, 2009 1:32 AM
Edited by: Skotty on Feb 26, 2009 1:36 AM
Edited by: Skotty on Feb 26, 2009 1:41 AM