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: Image problems

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Image problems

    Im using JOptionPanes and building an RPG as a project.

    I have .BMP maps and I want to use them inside my JOptionPane as to show the user where he/she is at.

    I have NO idea how to do this and none of my books quite explain it clearly.

    Thanks,
    Nick


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

    Default Re: Image problems

    See: Lesson: Working with Images (The Java™ Tutorials > 2D Graphics)

    You can load the image 'globally' (eg a full path to the image - not recommended) or package them into your jar and access it like:
    URL url = getClass().getResource("YourImagePathInJar");

    To display in a Swing app, you usually will create an ImageIcon from the image, and add that to a JLabel.

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Image problems

    Didn't help. Thanks though.

  4. #4
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Image problems

    Quote Originally Posted by Bekuraryou1228 View Post
    Didn't help. Thanks though.
    Did you follow the link and read the tutorial?

Similar Threads

  1. Blur Image
    By psrkiran in forum Algorithms & Recursion
    Replies: 10
    Last Post: December 31st, 2009, 07:57 AM
  2. Pixel Alteration in an image/image rotation
    By bguy in forum Java Theory & Questions
    Replies: 3
    Last Post: November 1st, 2009, 10:50 AM
  3. Replies: 2
    Last Post: June 29th, 2009, 03:06 PM
  4. GUI problem with image in java
    By Koâk in forum AWT / Java Swing
    Replies: 6
    Last Post: May 17th, 2009, 04:17 AM
  5. How images stores in awt.Image class?
    By BharatT in forum AWT / Java Swing
    Replies: 0
    Last Post: February 24th, 2009, 05:10 AM