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

Viewport takes more size than view

Status
Not open for further replies.

Reddy316

Programmer
Jul 24, 2001
25
IN
Hi All,
I have this problem, i have an object "ImageCanvas" extending JComponent on which i can set a jpeg image..this is a class provided by java itself. Now i have set this component as the view for a JScrollPane. The problem is that even though i have set the size for the viewport to be that of the imagecanvas object the viewport takes more size than the one i have specified and the scroll bars also are acting real strange.. i move one scrollbar and the other one also moves randomly..
Can anyone tell me what is going on.
I have used this piece of code...

String filepath = <path of my jpeg file>;
PlanarImage myimage = JAI.create(&quot;fileload&quot;,filepath);
ImageCanvas imageCanvas = new ImageCanvas(myimage);
JScrollPane scr = new JScrollPane();
scr.getViewport().add(imageCanvas);

Any help would be glady appreciated.

Thanx in advance,
Reddy316
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top