Zoom « JScrollPane « Java Swing Q&A





1. scrolling and zooming    coderanch.com

Hi, I am programming a muti-agents system and meet following problems in scrolling the JPanel: I have a lots of objects (constructed by shapes or by some images) but some objects has negative coordinates, e.g., a line from (100,100) to (-100, -100); How can I scroll to see those with negative coord? how should I zoom the pane (with respect to ...

2. JScrollPane + JPanel + zooming probs    coderanch.com

3. Wanted: Java2D example of zooming and panning with scroll bars    coderanch.com

I've been google searching for examples of zooming and panning with scroll bars and cannot find one. Can someone give me an example of at least panning with scroll bars some image or drawing that is too big to fit into the window? I can probably figure out zooming myself, although an example would be helpful. Thanks, Siegfried

4. Zoom map in JScrollPane, keep center of viewport    java-forums.org

Hi, I have a map displayed in a JScrollPane and zoom it by adjusting the setPreferredSize method of the map, then calling JScrollPane.revalidate. However, the center of the viewport does not point to the same position on the map anymore. How can I adjust that? I know the viewport.getViewPosition() method, but don't grasp the necessary mathematics to do the trick :confused: ...