JOptionPane question

Discussion in 'Mac Programming' started by bill macleod, Sep 8, 2006.

  1. macrumors newbie

    Sep 8, 2006
    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

    Attached Files:

  2. macrumors 68000


    Jun 6, 2003
    District of Columbia
  3. macrumors newbie

    Jul 31, 2006
    Huntsville Al
    Sounds Like a Look and Feel issue

    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.
  4. thread starter macrumors newbie

    Sep 8, 2006

    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

  5. macrumors regular

    Jan 28, 2006
    When I was trying to learn how to change the L&F in Java, I looked at the forums on

  6. macrumors 6502a


    Sep 22, 2005
    Chicago, IL
    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.
  7. thread starter macrumors newbie

    Sep 8, 2006
    one possible solution

    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.


    Attached Files:

Share This Page