Overview
JZoom is a horizontal control with two round buttons for zoom in/out functionality. Designed for use with zoomable canvases and image viewers.Constructor
Appearance
- Size: 32px height (fixed)
- Buttons: 24×24px round buttons
- Spacing: 6px between buttons
- Padding: 12px horizontal
- Background: Semi-transparent gray overlay
- Alignment: CENTER
Methods
Sets the action to execute when zoom in is clicked
Action to execute on zoom in
Sets the action to execute when zoom out is clicked
Action to execute on zoom out
Example Usage
With JDesignCanvas
With ImageView
Custom Zoom Logic
With Zoom Display
Keyboard Shortcuts
Animated Zoom
Styling
Style classes:.j-zoom- Main container- Buttons use inline styles for round appearance
Button Behavior
Default State
- Background:
rgba(203, 213, 225, 0.4) - Border radius: 50% (perfect circle)
- Size: 24×24px
Hover State
- Background:
rgba(203, 213, 225, 0.7) - Smooth transition
Icons
- Minus button:
JIcon.MINUS - Plus button:
JIcon.PLUS
Layout Tips
Floating Corner Position
Bottom Center
In Toolbar
Notes
- Buttons are always 24×24px (fixed size)
- Container height is fixed at 32px
- Semi-transparent background blends with any background
- Hover effect provides clear visual feedback
- Designed to float over content without obscuring it
- Works with any zoomable component via Runnable callbacks