where do i put my gif file? [message #448956] |
Sun, 16 January 2005 21:58 |
Victor Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Where do i put my gif file?
Ok, I think an hour is enough time, right?
===========================================
pls skip the following parenthetical rant
(<rant begins
Plus too bad i cant Search thru these messages here, i just have
to read all of them, and i can never find what i am looking for...
I AM CERTAIN WHAT I AM DOING HAS NOTHING TO DO WITH A PLUG-IN...
And i looked in the much touted eclipse help....
try "where do i put gif files", try "GIF files" try "images"...
rant ends>).
===========================================
i have a project. Chap05
It is a java project.
i create a new class, LabelExample, which contains one .gif file
(interspatial.gif)
when i go run my class,LabelExample, it cant find the gif...
where, using eclipse, do i specify where to find the gif file?
============================================
i created the interspatial.gif thru ms-paint, and saved it to
c:\temp
where do i put it? Where do i tell eclipse where to find it?
|
|
|
|
|
|
Re: Here's what i mean: [message #449000 is a reply to message #448995] |
Mon, 17 January 2005 16:17 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
If you di it that way, you need to do this instead or you will have an
unclosed stream laying around.
InputStream is = LabelExample.class.getResourceAsStream("interspatial.gif");
try {
Image image = new Image(display, is);
} finally {
try {
is.close();
} catch (IOException e) {
}
}
Christophe Cornu wrote:
> One simple solution:
>
> 1. save your image into the source folder that contains your class
> LabelExample.java
> 2. In your class LabelExample, load it through:
> Image image = new Image(display,
> LabelExample.class.getResourceAsStream("interspatial.gif"));
>
> Chris
>
>
--
Thanks,
Rich Kulp
|
|
|
|
Re: Here's what i mean: [message #449207 is a reply to message #449193] |
Wed, 19 January 2005 14:50 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Use content assist. It's part of the Java Editor, do ctrl+Space when you
cursor is at the end of the word InputStream and it will present you
with a list of possible completions. One of them will be the InputStream
you want, and when you select it with the enter key or the mouse it will
add the import automatically to your class.
By the way InputStream is a standard part of java. It is
java.io.InputStream.
Victor wrote:
> Rich Kulp wrote:
> InputStream is =
> LabelExample.class.getResourceAsStream("interspatial.gif");
>
>
> Rich
>
> Thanks for your input.
> I tried it, but was unable to get far.
>
> InputStream cannot be resolved.
>
> Apparently, i need to import the place where it lives.
>
> For the life of me, i cant figure out where it lives. . .
>
> So what i ask is this...
>
> How do i figure out where InputStream lives?
>
> I tried the help, obviously, but it doesnt help at all.
>
> I then tried by looking at the "Eclipse Platform Release 3.0"
> documentation....(thru the 'help')
> in the index actually. . . and InputStream is not even in the index.
>
>
> this is what i have in my imports:
> import org.eclipse.swt.*;
> import org.eclipse.swt.widgets.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.graphics.*;
>
>
>
>
--
Thanks,
Rich Kulp
|
|
|
|
Powered by
FUDForum. Page generated in 0.03977 seconds