File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Scrollable Canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Scrollable Canvas" Watch "Scrollable Canvas" New topic
Author

Scrollable Canvas

Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
Howdy all,
I'm really stuck on a problem and pretty sure I'm missing some obvious detail.
I am trying to implement a sort of scrollable canvas.
Why? I have an image that I want to display in an applet, but the image is much larger than the applet itself.
I've tried to implement this sort of scrollable canvas by adding drawImage(...) to the paint method of my canvas object, and then adding that canvas object to a scroll pane. This method seems to work with one small hitch......the full image never gets loaded. Only a portion of the image is drawn to the canvas......the protion that can fit the size of the canvas as originally allotted by the layout manager of the scroll pane.
I figure that the problem i'm having is that the layout manager of scroll pane sets the size of the canvas to accomodate the initial size of the scroll pane (which is smaller than the full image). So I tried setting the size of the canvas --setSize()-- to something ridiculously large, but this did not help? So now I'm just at a loss. If anyone made it all the way through this post and has any ideas, I'd really appreciate your comments.


Fun programming etcetera!
Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
Nevermind....I'm guilty of not doing a good search before I posted. I found the answer to my question at:
http://www.coderanch.com/t/330746/GUI/java/scroll-image
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Scrollable Canvas