- Components that supports zoom, needs to implement a "Zoomable" interface that knows the original location
- Java2D 's affine transform object is used for painting with zoom ratio
- A simple layout manager is written to handle positioning.
Loading ....
This is the simple interface that zoomable components have to implement:
Loading ....
Here is my (null) layout manager that keeps components where they claim to exist, and size that claim to have; proportional to application zoom ratio.
Loading ....
If you need more advanced layout like GridBagLayout you should implement it!
Note that according to what you plan to zoom/unzoom, things may get complicated. For example if you put multilevel deep containers, or advanced components that consist of multiple components they should all behave according to our plan!
Hope this is helpfull for someone.
Here is the resulting images:
[TODO regenerate images!]
Zoom Ratio: 0.25
Original size
Zoom ratio: 1.5
Zoom Ratio: 0.75
Zoom ratio: 0.10
Tempting isn't it? ;)