Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting ScrollPane size

 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if this belongs here or under Other API's. Sorry if this is the wrong forum.

I am learing JAI right now. That is the purpose of the following code. Please ignore the fact that I am turning something into a ByteArraySeekableStream when I really don't have to. I did that to see what to expect when my server socket sends down multi-page ByteArraySeekableStreams (I wanted to know if JAI could tell where one page starts and another begins with such a stream). The same is true for why I turn a RenderedImage to a PlanarImage (I am just testing and figuring out here).

Now I am trying to learn how to use the ScrollPane to work with the images I build. I have done several things trying to get ScrollPane to set its size to other than the size of the image. The convoluted code below just arbitrarily tries to set it to half the size of the image. But, it always grows to the size of the image no matter how I try to go about making its size static.



What I get when I run above is all images of my multipage tiff loaded in individual scrollpanes that are as large as the images. Can someone give me some feedback that may solve my problem?
 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Instead of using setSize function use setPrefferedSize() and see if it works....

scrollPane.setPrefferedSize(new Dimension(sizex/2,sizey/2));
 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was easy. Thanks for the response. Works like it is supposed to now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic