Solved

need help with getImage()

Posted on 1998-07-30
6
237 Views
Last Modified: 2011-09-20
with the getImage() method, it needs a URL and a string name for the agruements.  what do i put for the URL if it is a local file, but not in the same directory as the applet itself.  therefore i can't use the "getDocumentBase()" or "getCodeBase()".  so what's the answer?
0
Comment
Question by:typhoid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
aziz061097 earned 50 total points
ID: 1229291

Do something like this

Image img = getToolkit().getImage("test\\About.jpg");
g.drawImage(img, 0, 0, 615, 430, this);

0
 

Author Comment

by:typhoid
ID: 1229292
this might work, i kept getting a nullpointer exception which doesn't make sense to me, because there was nothing mispelled, and all the files were where i specified them to be.  i'm not sure what the "test" in your answer is, is that the path?
0
 
LVL 2

Expert Comment

by:aziz061097
ID: 1229293
Yes that is quite obvious . You have to escape the path ... I did not know you could not figure it out or I would give more explanation.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:aziz061097
ID: 1229294
I put the image file About.jpg in a sub directory "test".
0
 

Author Comment

by:typhoid
ID: 1229295
i could figure it out, i just wasn't positive, and i like to be positive.  anyway, thanx for the advice, it might help
0
 

Expert Comment

by:tparvaiz
ID: 1229296
Mr aziz have my reguards, i appreciate your help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question