File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Doubt in Images of AWT? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt in Images of AWT?" Watch "Doubt in Images of AWT?" New topic
Author

Doubt in Images of AWT?

navin kumar
Greenhorn

Joined: May 22, 2001
Posts: 9
Hello EveyOne,
Well, While running the following applet program, The applet was started.But it is
unable to draw the image as specified in the line.no:2 of the program.
My program is in the directory: c:\jdk1.2.2\bin
Path of the picture is : d:\simran~1\simran18.jpg
I already setted d:\simran~1 in the path & classpath.
What is the problem with the following Program.....Could anybody help me???
The program is as follows.........
file name is: app3.java

(edited by Cindy to put spaces in html and format code)

[This message has been edited by Cindy Glass (edited July 25, 2001).]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Works just fine for me in both IE and Netscape using jdk1.2.1 on WinNT.

What is actually happening?
What version of the jdk and os are you?

[This message has been edited by Cindy Glass (edited July 25, 2001).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
navin kumar
Greenhorn

Joined: May 22, 2001
Posts: 9
Dear sir,
I am using Windows 98 as OS & jdk1.2.2 and the Browser
is IE5.0 . The problem with this is The image is in one disk
"D:" drive and the program i.e. jdk1.2.2 is in C: drive. If we
copy the image from D: drive to c:\jdk1.2.2\bin then the program
is working.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You chose to use this version of getImage.
img=getImage(getDocumentBase(),getParameter("img"));
This is saying "look in the directory that my html is in and find this image file". Then you put the image file someplace else. Either you need to DO what you SAID, or you need to call your file using a different syntax.
Try something like:
img=getImage(new URL("d:\simran~1"),"simran18.jpg");
(I didn't try this line).
navin kumar
Greenhorn

Joined: May 22, 2001
Posts: 9
Dear sir,
I tried the statement that was said by You. i.e.
img=getImage(new URL("d:\simran~1"),"simran18.jpg");
But its not working. To use the URL's we have to use the main() method.
Will you suggest me some other solution. Thanks for giving response.
One more to say is:
public void paint(Graphics g)
{
g.getImage(img,10,10,this);
}
the method getImage is returning boolean value "false" which specifies that "image not found".

Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Is the file actually in a directory named d:\simran~1 fully and completely (looks like a temporary alias for the directory). The URL must have the full path to the directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Images of AWT?