...
> ...
> | I've seen people using this, .getImage( getCodeBase(),
[quoted text clipped - 4 lines]
> Did you think to try..
> .getImage( getCodeBase().toString() + "file.gif")?
Thanks for the suggestion. As you can tell, I'm a Java newbie.
I get unresolved symbol for getCodeBase().
Here's my imports:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import javax.swing.ImageIcon;
import javax.swing.border.Border;
import java.util.*;
import java.io.BufferedWriter;
import java.io.PrintWriter;
import java.io.IOException;
chris
Andrew Thompson - 14 Jan 2004 23:03 GMT
....
| > Did you think to try..
| > .getImage( getCodeBase().toString() + "file.gif")?
|
| Thanks for the suggestion. As you can tell, I'm a Java newbie.
As you might be able to tell (very soon),
I f***ed up! Sorry, I misread your question
as being an Applet (where you _can_ use
getCodeBase() ), as a more general thing,
for applets, application, jar files...
you can use the magical
Class.getResource("file.gif");
To get an URL to the resource.
HTH
(this time!)
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Swede - 18 Jan 2004 22:01 GMT
Hiya!
This thread solved my problem with relative paths as well.
Thanks for sharing!
/Lars
> ....
> | > Did you think to try..
[quoted text clipped - 21 lines]
> * http://www.1point1C.org/ 1.1C - Superluminal!
> * http://www.AThompson.info/andrew/ personal site
Thomas Weidenfeller - 15 Jan 2004 07:36 GMT
> Thanks for the suggestion. As you can tell, I'm a Java newbie.
Newbie questions are supposed to go to comp.lang.java.help.
> I get unresolved symbol for getCodeBase().
Read the API documentation for exactly(!) the version of Java you are
using. Check the documentation for the package and class name of that
method.
Regarding your GUI problems, I would suggest you work through the
beginner's tutorial on Sun's web site first, followed by the GUI tutorials.
Also, consider not wasting your time with applets, but start with
applications. That way you have one thing less to worry about (no
worries about ancient VMs in browsers and differences in plug-in behavior)
/Thomas
Andrew Thompson - 15 Jan 2004 11:50 GMT
...
| > I get unresolved symbol for getCodeBase().
|
| Read the API documentation for exactly(!) the version of Java..
<snip good links>
The OP was probably reading the correct
doc's Thomas, trouble is I 'guessed' it was an
applet and led the the conversation astray..
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site