Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Using Icons in JOptionPane

  1. #1
    Junior Member Jchang504's Avatar
    Join Date
    Nov 2008
    Posts
    28
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Using Icons in JOptionPane

    How do you use the Icon argument in a JOptionPane method like JOptionPane.showMessageDialog? Does the image file have to be a specific format like GIF or JPG, or a specific size file or specific dimensions? Please give an example of code that uses the Icon argument. I am an amateur programmer and I can't figure out why it doesn't work.


  2. #2
    Junior Member
    Join Date
    Sep 2014
    Location
    Goulds, FL
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Using Icons in JOptionPane

    No image is required for messages like that. The syntax I usually use is

    JOptionPane.showMessageDialog(null, String, Title String, JOptionPane.INFORMATION_MESSAGE)

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    897
    Thanks
    0
    Thanked 166 Times in 148 Posts

    Default Re: Using Icons in JOptionPane

    Just 6 years late.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,372
    Thanks
    183
    Thanked 836 Times in 779 Posts
    Blog Entries
    5

    Default Re: Using Icons in JOptionPane

    Thread locked

Tags for this Thread