Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


[java] damn it bones I need pictures not just code

This topic is 6189 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote the code to get a picture to pop up in an applet, I am not getting any errors and its running but no picture is coming up.

Share this post

Link to post
Share on other sites
Are you using media tracker to make sure the image is loaded before you try and display it? Otherwise your image data will be null and the image will not ( or just partially ) display.

Share this post

Link to post
Share on other sites
import java.awt.*;
import java.applet.*;
import java.awt.Image;
import java.awt.Graphics;
import java.net.URL;
import java.util.*;

public class GTest extends Applet
private Image im;//for displaying image line 1
private Image LEFT;

public void init()

im= getImage(getDocumentBase(), "CW1002.gif");
// display image line 2
LEFT = getImage(getDocumentBase(), "WALLP.jpg");


public void paint(Graphics g)
Dimension size = getSize();

//display image line 3



public boolean imageUPdate(Image image, int flags, int x,
int y, int w, int h){
//display image line 4

repaint(); //display image line 5

if ((flags & ALLBITS) ==0)
return true; //** need more updates
return false; };//** image fully loaded
// display inage line(s) 6
// this code displays 2 Images (that are visible)
//this wrote comments next to the lines crucial to //displaying //image and tried to remove the non essential
//Check out Graphic Java -mastering the JFC- Volume 1 AWT
// otherwise you hit more obstacles just like this
// GL HF

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!