CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Scrolling Panel

  1. #1
    Guest

    Scrolling Panel

    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...


  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: Scrolling Panel

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured