Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

Image in a component

Thread view: 
My full name - 04 Dec 2003 23:56 GMT
Hi,

I want to draw a personnalised JComponent (let's name it GridCell for
instance) which would contain a small Icon.
The display method (paint() ?) would paint an icon given its internal
parameter.

What I need to know is how to do that in Java ? ;o)

I have no idea how to make it work. I tried ImageIcon, BufferedImage and so
on with no results.

Finally, the icons I want to show would be scaled to the size of the
personnalised JComponent (GridCell).

Thanks in advance for any advice.
Andrew Thompson - 05 Dec 2003 04:52 GMT
...
> What I need to know is how to do that in Java ? ;o)

What you probably need to do is the Java tutorials.
(What, ..did you think we would spoon-feed you?)

> I have no idea how to make it work. I tried ImageIcon, BufferedImage and so
> on with no results.

Oh?  Where are your short, self contained, compileable
examples?  What were the stacktraces of the failures,
what was the ouput?  Do you have the examples you
made as Applets, so that we can surf to the site and see
them fail for ourselves?

> Thanks in advance for any advice.

Do some work yourself and come back with either a
a) 'point me to the class' question, or
b) 'why does this code give this stacktrace' type
question.

But, to toss you a bone, you may find some good
image related source through the site of Marco Shmidt, at..
http://www.geocities.com/marcoschmidt.geo/

[ ..and he is generally much nicer than me, as well   ;-) ]

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
ak - 05 Dec 2003 07:01 GMT
> I want to draw a personnalised JComponent (let's name it GridCell for
> instance) which would contain a small Icon.
sounds like JLabel.

____________

http://reader.imagero.com the best java image reader.
Todd Corley - 05 Dec 2003 13:16 GMT
"My Full Name" made me laugh. :)

The easiest way to put and icon on a JComponent is to use a JLabel and
ImageIcon combination.

Create an ImageIcon from a jpg and add it to the JLabel.  That will
handle all of the sizing for you automatically.
My full name - 06 Dec 2003 12:23 GMT
Thanks to all of you (yes even you Andrew ;o) who replied to my apparently
confused request :)

My full name.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.