bring graphics file into project

Posted on 1998-08-01
Last Modified: 2013-11-19
i am using symantec visual cafe
i want to bring a graphics file (bmp, jpg, etc.) into the project (much like one would add a resource to Visual C++)

how is this done?
Question by:jdaues
  • 3
  • 2

Expert Comment

ID: 1230374
In the paint method of the Applet write the following code. where MyImage.jpg exists in the same directory where the applet is launched. You can even specify a path if the image file exists in other directory by getImage("\\Mydirectory\\MyImage.jpg");

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


Author Comment

ID: 1230375
ummm...i guess i wasn't clear enough in my question.. your code is good, and in fact looks a lot like what i have already written.  what i wanted was a way to include the graphics file in my project, as opposed to the file being a separate piece.


Accepted Solution

sailwind earned 50 total points
ID: 1230376
For me, I use the insert to add the image files to my project.
In Cafe, go to:
Insert -> files into project
choose files of type "net files", then select all the files you want
to include in your project and click on add.

- Tony

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.


Author Comment

ID: 1230377
that's closer...i want to be able to refer to the bitmap within my project as a resource,
not a file.  is that possible?

Expert Comment

ID: 1230378

First of all, can you clarify what's the difference between using the bitmap
as a resource and a file? Do you mean you want to access the bitmap when
you compile but not when you generate the final archive? What would the
advantage be to referring the bitmap as a resource as opposed to a file?
I looked around in the help file but didn't see any specifications for adding a
resource, only individual files.


Author Comment

ID: 1230379
>can you clarify what's the difference between using the bitmap as a resource and a file
its something i am accustomed to doing in Visual C++, but apparently not possible in Visual Cafe.  its just a convenience of having the graphic in the project, as opposed to externally.

>I looked around in the help file but didn't see any specifications for adding a
>resource, only individual files.
i didn't either, but i just started using Visual Cafe last weekend, so i thought i would ask


Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Add visuals to your Prezi to keep your audience engaged. Learn how to embed images, edit them, and more in this video micro tutorial. Select "Insert" from the top menu in your Prezi editor: Select "Image": A toolbar will pop in from the right …
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…

785 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