Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I display an image (jpg) on a scrollable frame?

Status
Not open for further replies.

frag

Programmer
Dec 7, 2000
321
GB
Hi it's me again!

Here is my second problem:
I want to display a jpg-file on a scrollable frame/window.
I have no idea where to start! I don't even know how to open an image (i can only open text-files)!! :-I

Oh.. by the way... does anyone know how to set a filefilter for jpg-files in a JFileChooser?

thanx a lot!

frag patrick.metz@epost.de
 
For the jpg filechoose thing check in the api and use the files they provide for it. (they have done is already);
For getting image look at toolKit and getImage().

For scrollpane look at JScrollPane and a JPanel to it you must set the preffered size of the panel to be the size of image so that the scroll bars come up.

If you need more
Post

Chris good luck ( I know how you feel)
 
Hi, this is frag again!

Sorry boys, I am just too stupid for this!
I know that I need a JScrollPane and a JViewport but I don't know how to handle this stuff.
The example given on java.sun.com is too hard (I don't want to have a ruler!) and I can't change it to an easier one.
All I want is to display an image on a scroable frame!

Could please somebody trop me some lines of code?!?

Very thankful

frag patrick.metz@epost.de
 
Hi!

Ok, just forget it. I finaly did it on my own (after 3 hours of research)!

But thanx anyway!

cya

frag patrick.metz@epost.de
 
frag,

> I finaly did it on my own (after 3 hours of research)!

Yup, that's the way it is supposed to work. None of us was born knowing how to do any of this stuff. If we know, it's because we did the 3 hours of research to learn it.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top