Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Programmer > handling resize...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 52667 of 53788
Post > Topic >>

handling resize events with JScrollPane

by RichT <someone@[EMAIL PROTECTED] > May 12, 2008 at 08:09 PM

Hi,

I am struggling to make the JScrollPane resize with its component

I have a JFrame with border layout, top toolbar, bottom a panel with 
status information, and a JScrollPane in the centre, and the JSCrollPane 
  contains a JComponent.

I set a component resize listener to the JComponent but it seem to 
resize the component in slow motion but still does not display the 
scrollbars, the component in the centre is larger (I know this because 
this has an image drawn on it)

imageComponent = extended JComponent.
componentScrollPane = JSCrollPane.

this is the code I am using in the frame

imageComponent.addComponentListener(new ComponentListener() {
         	   public void componentResized(ComponentEvent ce) {
         		
         		   componentScrollPane.setSize(new 
Dimension(getImageComponent().getSize()));
         		   System.out.println("In Component resized");
    				
    			}

As the image is resized so is the imageComponent, and I want the 
imageComponent centred in the JScrollPane and scroll bars to appear to 
view the rest of the image on the imageComponent.

When the Image is zoomed, the imageComponent should be resized to fit 
the new size of the zoomedImage, I am calling this manually and I am 
sizing the imageComponent then calculating the size of the image and 
drawing to the imageComponent, the component seems to work in slow 
motion, growing and then shrinking in a word weird!!

Any help really appreciated
Rich
 




 5 Posts in Topic:
handling resize events with JScrollPane
RichT <someone@[EMAIL   2008-05-12 20:09:55 
Re: handling resize events with JScrollPane
Knute Johnson <nospam@  2008-05-12 14:34:58 
Re: handling resize events with JScrollPane
RichT <someone@[EMAIL   2008-05-13 21:16:05 
Re: handling resize events with JScrollPane
Knute Johnson <nospam@  2008-05-13 16:56:29 
Re: handling resize events with JScrollPane
RichT <someone@[EMAIL   2008-05-15 00:32:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:38:26 CDT 2008.