Click to See Complete Forum and Search --> : Scrolling Panel


August 2nd, 1999, 07:38 AM
I am trying to create a Panel that will scroll a graphical object. I have the layout and scrolling all taken care of, now i'm trying to implement a way for the scroll bars to appear only if the drawing is to large for the panel. I can detect when this should occur, and print a message to the command line, saying the scroll bars should be displayed, but I can't find a way to get them up there. I've created a JPanel to contain another JPanel and two JScrollBars. I am using a GridBagLayout. I've tried settingthe old JPanel to visible(false) and then adding the scrollbars, making the JPanel a new object and adding it, but nothing seems to work. I figure what i have to do is make the original object and then when the graphic is loaded, determine if its to large. If it is, remove the old object and make a new one with scrollbars. Any suggestions...

unicman
August 2nd, 1999, 08:07 AM
Whenever u r substituting (adding/removing) any compoent, r u calling 'validate' and 'paint' method of the container (which contains the component u changed)?

I'm not sure if u need to call 'paint' method also, but u should call 'validate' method atleast.
If calling 'validate' doesn't work, try calling 'invalidate' before calling 'validate'.

- UnicMan
http://members.tripod.com/unicman