Square should remembers its "real" position, as in previous code
Somebody (Model) should remembers current X and Y panning offsets
Then apply the panning offsets as a correction factor whenever you:
draw()
pick, i.e. isInside()
Provide user controls to change the panning offsets (in ControlGlobal)
Choose range suitable for actual panel size ... preferably dynamically
Could use direct mouse dragging to pan
(Don't clobber "loc", make deep copy instead)
Alternatives:
Could implement using Java2D transforms
Lay out the scroll bars on side and bottom of panel
Use a JScrollPane
Trickier: First, decide what does user mean by zoom? What is center point?
Again, objects remember "real" position
Again, apply zoom factor for draw() and isInside()
Provide a user control for amount of zoom
When you download ButtonApp4, you won't get the GIF files for the arrows, so just change the ArrowButton code
From: setIcon (new ImageIcon ("leftArrow.gif"))
To: setText ("Left")
(and the same for rightArrow)