Java Programming Help: Following Code Does Not Display Image

/**/
import java.applet.Applet;
import java.awt.*;
import java.awt.image.*;
public class ImageTest extends Applet
 
{
private Image img;
public void init()
{ img = null; }
public void loadImage() {
try {
img = getImage(getCodeBase(),"D:/backup/mydoc/Picture/picture 002.JPEG");
System.out.println(img);
System.out.println(prepareImage(img, 300, 400, this)); } catch(Exception e){} }
public void paint(Graphics g) {
if (img == null)
{
loadImage();
g.drawImage(img, 10, 10, this);}
else
System.out.print("jj");
}}
 
y this code is unable to show image?

Replies

  • pothedarvamsi
    pothedarvamsi
    Isn't it showing any error?
    if it doesn't then create another new document using notepad(ofcourse we knew that) and rewrite the program then execute it. Sure u'll get the output.
  • rahul69
    rahul69
    try using '\\' instead of '/' in D:/ backup...
  • sulochana anand
    sulochana anand
    i tried every way as i can but no result.

You are reading an archived discussion.

Related Posts

The canteen food can't be forgotten ever, right? Here's a comic dedicated to everyone who's had canteen food.
What is the difference between Analog signal and Digital signal.? And How to identify them.?
How does data is transferred by Bluetooth between devices ?
hi CE can anyone tell me how to block adult site
JAVA is the most useful programming language now a days. Most of the Companies seek students who already know JAVA or at least know its basics. WHY?? Due to its...