Hi guys,
I want to display an image within a frame. this is how i
am trying to do it.
import java.awt.*;
public class ImageDemo extends Frame
{
MyCanvas canvas;
Image image = null;
public ImageDemoApplet()
{
image =
getParent().getToolkit().getImage("Software.jpg");
canvas = new MyCanvas(image);
add(canvas);
}
public static void main(String args[])
{
ImageDemoApplet app = new ImageDemoApplet();
app.resize(500, 500);
app.show();
app.toFront();
}
}
class MyCanvas extends Canvas
{
Image image;
public MyCanvas(Image img)
{
image = img;
setBackground(Color.white);
resize(500, 500);
}
public void paint(Graphics g)
{
g.drawImage(image, 0, 0, this);
}
}
I get the frame but not the image. why? Can somebody
make a correction and let me know. please........ Can
anybody give me some pointers.
pavan
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".