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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get picture size ----------------------------

Status
Not open for further replies.

DaniDak

Technical User
Mar 13, 2002
44
US
Hi,
I'm new to java.
When I load an image(picture) from file, I need to get the width and heigth of that image so I can resize the JFrame to be the exact size as the image.

Thank you
 
You mean as in the class Image methods getHeight and getWidth?

-pete
 
I have two classes PictureFrame and Picture class.
PictureFrame:
private Image picture;
I load the image in this class.

Picture:
this class is used to display the loaded picture in a JFrame that is the exact size of the image that I loaded.
That is why I need the width and height.

 
>> private Image picture;
>> I load the image in this class.

Then after it's loaded you can call "pictures" getWidth/getHeigth member functions.

does that help
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top