Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Doubt in Images of AWT?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
navin kumar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic