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 2 Times in 2 Posts

    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. The Following User Says Thank You to Jchang504 For This Useful Post:



  3. #2
    Junior Member
    Join Date
    Sep 2014
    Location
    Goulds, FL
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post

    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)

  4. The Following User Says Thank You to ChristianBethel For This Useful Post:


  5. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: Using Icons in JOptionPane

    Just 6 years late.

  6. The Following User Says Thank You to Cornix For This Useful Post:


  7. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Using Icons in JOptionPane

    Thread locked

  8. The Following User Says Thank You to copeg For This Useful Post:


Tags for this Thread