Archived

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

thomashun

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

Recommended Posts

snowmoon    122
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
lupine    122
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();
setBackground(Color.black);

g.drawImage(im,350,50,this);
//display image line 3

g.drawImage(LEFT,1,1,this);

g.dispose();
}


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
else
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