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 2 of 2

Thread: cant add icon for joptionpane

  1. #1
    Junior Member
    Join Date
    Dec 2021
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default cant add icon for joptionpane

    import javax.swing.JOptionPane;
    import javax.swing.ImageIcon;
     
    public class lol {
     
          public static void main(String[] args) {
     
              ImageIcon icon = new ImageIcon("https://files.worldwildlife.org/wwfcmsprod/images/Sea_Turtle_Hol_Chan_Marine_Reserve_WW1105958/hero_small/5fv88fm3v6_Sea_Turtle_Hol_Chan_Marine_Reserve_WW1105958.jpg");
              JOptionPane.showMessageDialog(null,"Message","Title",JOptionPane.PLAIN_MESSAGE,icon);
        }
    }
    Last edited by Norm; December 3rd, 2021 at 06:43 AM. Reason: changed code tag

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,163
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: cant add icon for joptionpane

    The ImageIcon takes a URL object for remote images.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Image folder-icon
    By almir97 in forum JavaFX
    Replies: 12
    Last Post: March 6th, 2021, 10:38 AM
  2. Why won't the frame Icon change?
    By cbplayer in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 27th, 2013, 12:02 AM
  3. [Asking] Icon Menu doesn't appear
    By ardisamudra in forum Android Development
    Replies: 0
    Last Post: November 3rd, 2012, 09:37 PM
  4. window icon
    By luisp88 in forum AWT / Java Swing
    Replies: 6
    Last Post: September 29th, 2011, 01:56 PM
  5. [SOLVED] I cant load the icon!!!!
    By chronoz13 in forum AWT / Java Swing
    Replies: 12
    Last Post: January 22nd, 2010, 03:52 AM