Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » where do i put my gif file?
where do i put my gif file? [message #448956] Sun, 16 January 2005 21:58 Go to next message
Victor is currently offline VictorFriend
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?
Here's what i mean: [message #448958 is a reply to message #448956] Mon, 17 January 2005 00:59 Go to previous messageGo to next message
Victor is currently offline VictorFriend
Messages: 12
Registered: July 2009
Junior Member
here's what i mean:

Image image = new Image(display, "interspatial.gif");

Where in the project do i specify where the gif is
to be found?

For now i just made it like this, and it works:
"C:\\TEMP\\interspatial.gif"

but there has to be a way of copying the resources
into the project. Isnt there?
Re: Here's what i mean: [message #448963 is a reply to message #448958] Mon, 17 January 2005 06:02 Go to previous messageGo to next message
Bo Majewski is currently offline Bo MajewskiFriend
Messages: 17
Registered: July 2009
Junior Member
> Image image = new Image(display, "interspatial.gif");
>
> Where in the project do i specify where the gif is
> to be found?

You could store them in the plug-in directory or its subdirectory and
fetch them using the method I described in "Re: path to images" message.
For example, if you stored images in a directory called "images" under
your plug-in's directory, you can fetch them using
MyPlugin.getDefault().getImage("images/interspatial.gif");
Re: Here's what i mean: [message #448995 is a reply to message #448958] Mon, 17 January 2005 15:13 Go to previous messageGo to next message
Christophe Cornu is currently offline Christophe CornuFriend
Messages: 304
Registered: July 2009
Senior Member
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
Re: Here's what i mean: [message #449000 is a reply to message #448995] Mon, 17 January 2005 16:17 Go to previous messageGo to next message
Eclipse UserFriend
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 #449193 is a reply to message #449000] Wed, 19 January 2005 03:14 Go to previous messageGo to next message
Victor is currently offline VictorFriend
Messages: 12
Registered: July 2009
Junior Member
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.*;
Re: Here's what i mean: [message #449207 is a reply to message #449193] Wed, 19 January 2005 14:50 Go to previous messageGo to next message
Eclipse UserFriend
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
That is so cool! [message #449278 is a reply to message #449207] Thu, 20 January 2005 03:34 Go to previous message
Victor is currently offline VictorFriend
Messages: 12
Registered: July 2009
Junior Member
Rich Kulp wrote:

> 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.
> By the way InputStream is a standard part of java. It is
> java.io.InputStream.


Thanks for the ctl+space thingy!
and thanks for having patience with me on the java.io thing!
I KNEW THAT! (so why was i spinning my wheels for an hour?)
Previous Topic:How to get parent window's location in new popup window?
Next Topic:pocket PC - ScrollBar.setVisible()
Goto Forum:
  


Current Time: Fri Apr 26 03:15:30 GMT 2024

Powered by FUDForum. Page generated in 0.03519 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top