Package com.teamdev.jxbrowser.zoom
Interface Zoom
public interface Zoom
Allows configuring zoom level for the domain of the currently loaded web page.
A Zoom instance belongs to Browser and can be used only if Browser is
alive. When Browser is closed, the Zoom instance automatically updates its
internal state and does not allow modifying zoom anymore. The IllegalStateException will
be thrown in this case.
The zoom level is configured for each domain separately, so if you set zoom level for "a.com", it will not be applied for "b.com". If you change zoom level for one domain and then load another one, then the zoom level for another domain will be default.
The zoom level per domain configurations are kept by the Profile instance, and they
are preserved after closing a Browser the Zoom instance belongs to.
-
Method Summary
Modifier and TypeMethodDescriptionbrowser()Returns theBrowserinstance of this zoom.voiddisable()Disables the possibility to change zoom levels for the loaded web pages and resets zoom level of the loaded web pages to the default value.voidenable()Enables the possibility to change zoom levels for the loaded web pages.voidin()Performs zoom in on the currently loaded web page.booleanIndicates whether zoom level can be changed or not.level()Returns the zoom level associated with the domain of the currently loaded web page.voidUpdates the zoom level for the domain of the currently loaded web page.voidout()Performs zoom out on the currently loaded web page.voidreset()Resets zoom level for the domain of the currently loaded web page to the default value.
-
Method Details
-
browser
Browser browser()Returns theBrowserinstance of this zoom.- Since:
- 7.28
-
level
ZoomLevel level()Returns the zoom level associated with the domain of the currently loaded web page.- Returns:
- zoom level of the domain of the currently loaded web page. If the web page is not loaded, returns the default value
- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
level
Updates the zoom level for the domain of the currently loaded web page.- Parameters:
zoomLevel- a new zoom level- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
in
void in()Performs zoom in on the currently loaded web page.- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
out
void out()Performs zoom out on the currently loaded web page.- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
reset
void reset()Resets zoom level for the domain of the currently loaded web page to the default value.- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed- See Also:
-
isEnabled
boolean isEnabled()Indicates whether zoom level can be changed or not. By default, it can be changed.- Returns:
trueif zoom level can be changed- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
enable
void enable()Enables the possibility to change zoom levels for the loaded web pages.- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-
disable
void disable()Disables the possibility to change zoom levels for the loaded web pages and resets zoom level of the loaded web pages to the default value. All attempts to change zoom level after that will be ignored.- Throws:
ObjectClosedException- whenBrowserof the currentZoomis closed
-