PDA

View Full Version : JOptionPane question




bill macleod
Sep 8, 2006, 09:22 AM
Hi all,

Brand new to Java and to this forum, glad I found you. So far, I've been having a lot of fun learning Java and owning a new mac. I've got a question
I hope you can help me with.

I came up with an apparent glitch in the system, that seems to be specific to the mac, while writing a simple begginers program .

I'm using JDK5 and Eclipse3.2 on a MacBookPro, although I tried this in the terminal also and got the same results.

When I call JOptionPane.showInputDialog() and try to change the MESSAGE_TYPE nothing happens (please see attached screen shot) The MESSAGE_TYPE icon is always an exclamation point.

I've tried this on a windows machine w/ JBuilder and Eclipse and am able to change the icon. As I said earlier, tried it in the terminal on the mac also.

I know it is a small thing, but, I'd kinda like to know what is going on and if there may be more issues like this.

Thanks for taking the time.

bill macleod



savar
Sep 8, 2006, 09:34 AM
I don't have my Mac to test, but it looks like you have indeed found a bug.

I suggest you report it to Apple:
http://www.apple.com/macosx/feedback/

hsvmoon
Sep 8, 2006, 12:37 PM
Try changing your app to the cross platform look and feel. If the problem goes away it is Apple's L&F. I have run into some odd errors with it in the past. For the most part the apple L&F is very good, but as with any L&F you are bound to find behaviour you did not expect.

bill macleod
Sep 8, 2006, 03:44 PM
Thanks for the replies. I dont really know how to change to cross platform look and feel. I'll do some googling tonite and see if I can figure it out. Would you have some links to start me off?

thanks again

bill

atmenterprises
Sep 8, 2006, 04:13 PM
When I was trying to learn how to change the L&F in Java, I looked at the forums on java.sun.com.

Thanks for the replies. I dont really know how to change to cross platform look and feel. I'll do some googling tonite and see if I can figure it out. Would you have some links to start me off?

thanks again

bill

NewbieNerd
Sep 8, 2006, 04:17 PM
I have been using these exact same images on my Intel iMac the past couple of days. You are correct that the QUESTION_MESSAGE and the INFO_MESSAGE are the exact same. If you try WARNING_MESSAGE and ERROR_MESSAGE, you should see different Icons, namely a yellow triangle and stop sign, respectively. I'm not sure why there is now QUESTION_MESSAGE icon, though.

bill macleod
Sep 30, 2006, 12:58 AM
Hi everybody.

I have a solution that works (for now) for this problem. I went in and tried all kinds of
different combinations of OPTIONS and MESSAGES in JOptionPane and on the mac they
are all sort of goofed up; wrong icons etc.

I took one posters suggestion and learned how to setLookAndFeel. That was OK for a
while but I never really got what I was after. One of the varieties looked like CDE on solaris, yuck.

So, I was doing some reading and came across this: a way to add any of my own photos (after resizing)
to JOptionPane as an icon. I may be wierd but I thought this was very cool and simple. Check the thumbnail
below for the code snippet and a smple JOP. This maybe old hat to some out there but I really got a kick
out of playing with it.

bill