DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005

    Unhappy Getting frustrated with this... please help...


    I have implemented some sort of a drawing board that extends a JPanel. Drawing of nodes and lines is done there. The JPanel is inside a scrollpane, and it's size will increase/decrease - like the zooming functionality when the user tries to click the JPanel. I am already done with the zooming functionality. My problem now is on Panning (or move) functionality. I really don't have any idea how to do this. It's like when the user is in panning mode, he can drag the JPanel to display the viewport it wants in the scrollpane.

    Please Help...

  2. #2
    Join Date
    Nov 2004

    Two ways at least...

    If you code your visible objects so they all place themselves according to a reference point (upperLeft ? ), then in pan mode you could move this reference point according to the dragging and do repaints as you go along.


    You could place the panel extension inside a JScrollPane, detect mouse dragging (in pan mode) and scroll accordingly, but I have not tested that appoach yet.
    eschew obfuscation

Similar Threads

  1. Frustrated learning Java
    By Mr. T in forum Java
    Replies: 5
    Last Post: 12-12-2002, 07:07 AM
  2. C# or Java
    By Ravi in forum Careers
    Replies: 9
    Last Post: 04-30-2001, 05:46 PM
  3. Replies: 1
    Last Post: 02-20-2001, 07:55 PM
  4. Replies: 4
    Last Post: 09-25-2000, 11:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.