Simple usage example:
if (JBR.isSomeServiceSupported()) { JBR.getSomeService().doSomething(); } else { planB(); }
Implementation note:
JBR API is initialized on first access to this class (in static initializer). Actual implementation is linked on demand, when corresponding service is requested by client.-
Method Summary
Modifier and TypeMethodDescriptionstatic AccessibleAnnouncerThis interface provides the ability to speak a given string using screen readers.static AccessibleAnnouncergetAccessibleAnnouncer(Extensions... extensions) This interface provides the ability to speak a given string using screen readers.static StringReturns JBR API version.static DesktopActionsAllows desktop actions, like opening a file, or webpage to be overridden.static DesktopActionsgetDesktopActions(Extensions... extensions) Allows desktop actions, like opening a file, or webpage to be overridden.static FontExtensionsFont-related utilities.static FontExtensionsgetFontExtensions(Extensions... extensions) Font-related utilities.static FontMetricsAccessorProvides convenience methods to accessFontMetricsinstances, and obtain character advances from them without rounding.static FontMetricsAccessorgetFontMetricsAccessor(Extensions... extensions) Provides convenience methods to accessFontMetricsinstances, and obtain character advances from them without rounding.static GraphicsUtilsGraphics2D utilities.static GraphicsUtilsgetGraphicsUtils(Extensions... extensions) Graphics2D utilities.static HiDPIInfoProvides a description of the current desktop operating environment appertaining to hi-DPI properties such as monitor resolutions, scaling, etc.static HiDPIInfogetHiDPIInfo(Extensions... extensions) Provides a description of the current desktop operating environment appertaining to hi-DPI properties such as monitor resolutions, scaling, etc.static StringReturns JBR API version supported by current runtime or "UNKNOWN".static JstackJstack-related utilities.static JstackgetJstack(Extensions... extensions) Jstack-related utilities.static KeyboardJBR API to inspect additional properties of AWT key events and keyboards.static KeyboardgetKeyboard(Extensions... extensions) JBR API to inspect additional properties of AWT key events and keyboards.static NativeRasterLoaderDirect raster loading for VolatileImage.static NativeRasterLoadergetNativeRasterLoader(Extensions... extensions) Direct raster loading for VolatileImage.static ProjectorUtilsGraphicsEnvironment-related utilities.static ProjectorUtilsgetProjectorUtils(Extensions... extensions) GraphicsEnvironment-related utilities.static RelativePointerMovementAllows getting relative mouse pointer movement.static RelativePointerMovementgetRelativePointerMovement(Extensions... extensions) Allows getting relative mouse pointer movement.static RoundedCornersManagerThis manager allows decorate awt Window with rounded corners.static RoundedCornersManagergetRoundedCornersManager(Extensions... extensions) This manager allows decorate awt Window with rounded corners.static ScreenshoterProvides a way to take screenshots of an individualWindowwithout involving the operating system's window manager.static ScreenshotergetScreenshoter(Extensions... extensions) Provides a way to take screenshots of an individualWindowwithout involving the operating system's window manager.static SharedTexturesThe service provides functionality for working with shared textures in JetBrainsRuntime.static SharedTexturesgetSharedTextures(Extensions... extensions) The service provides functionality for working with shared textures in JetBrainsRuntime.static SystemShortcutsQuerying system shortcutsstatic SystemShortcutsgetSystemShortcuts(Extensions... extensions) Querying system shortcutsstatic SystemUtilsExtends services provided by java.lang.System and similar.static SystemUtilsgetSystemUtils(Extensions... extensions) Extends services provided by java.lang.System and similar.static TextInputThis is a JBR API for text-input related functionality for applications that implement custom text components.static TextInputgetTextInput(Extensions... extensions) This is a JBR API for text-input related functionality for applications that implement custom text components.static VulkanAccess to the Vulkan rendering backend, if available.static VulkangetVulkan(Extensions... extensions) Access to the Vulkan rendering backend, if available.static WindowDecorationsWindow decorations consist of title bar, window controls and border.static WindowDecorationsgetWindowDecorations(Extensions... extensions) Window decorations consist of title bar, window controls and border.static WindowMoveX11 WM-assisted window moving facility.static WindowMovegetWindowMove(Extensions... extensions) X11 WM-assisted window moving facility.static booleanChecks whetherAccessibleAnnouncerservice is supported by the runtime.static booleanChecks whether JBR API is available at runtime.static booleanChecks whetherDesktopActionsservice is supported by the runtime.static booleanisExtensionSupported(Extensions extension) Checks whether given extension is supported.static booleanChecks whetherFontExtensionsservice is supported by the runtime.static booleanChecks whetherFontMetricsAccessorservice is supported by the runtime.static booleanChecks whetherGraphicsUtilsservice is supported by the runtime.static booleanChecks whetherHiDPIInfoservice is supported by the runtime.static booleanChecks whetherJstackservice is supported by the runtime.static booleanChecks whetherKeyboardservice is supported by the runtime.static booleanChecks whetherNativeRasterLoaderservice is supported by the runtime.static booleanChecks whetherProjectorUtilsservice is supported by the runtime.static booleanChecks whetherRelativePointerMovementservice is supported by the runtime.static booleanChecks whetherRoundedCornersManagerservice is supported by the runtime.static booleanChecks whetherScreenshoterservice is supported by the runtime.static booleanChecks whetherSharedTexturesservice is supported by the runtime.static booleanChecks whetherSystemShortcutsservice is supported by the runtime.static booleanChecks whetherSystemUtilsservice is supported by the runtime.static booleanChecks whetherTextInputservice is supported by the runtime.static booleanChecks whetherVulkanservice is supported by the runtime.static booleanChecks whetherWindowDecorationsservice is supported by the runtime.static booleanChecks whetherWindowMoveservice is supported by the runtime.
-
Method Details
-
isAvailable
public static boolean isAvailable()Checks whether JBR API is available at runtime.- Returns:
- true when running on JBR which implements JBR API
-
getApiVersion
Returns JBR API version. Development versions of JBR API return "SNAPSHOT". When running on Java 8, returns "UNKNOWN".Note:
This is an API version, which comes with client application, it is *almost* a compile-time constant and has nothing to do with JRE it runs on.- Returns:
- JBR API version in form
MAJOR.MINOR.PATCH, or "SNAPSHOT" / "UNKNOWN".
-
getImplVersion
Returns JBR API version supported by current runtime or "UNKNOWN".Note:
This method can return "UNKNOWN" even when JBR APIisAvailable().- Returns:
- JBR API version supported by current implementation or "UNKNOWN".
-
isExtensionSupported
Checks whether given extension is supported.- Parameters:
extension- extension to check- Returns:
- true if extension is supported
-
isAccessibleAnnouncerSupported
public static boolean isAccessibleAnnouncerSupported()Checks whetherAccessibleAnnouncerservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
AccessibleAnnouncerand its dependencies (can fully implement given service). - See Also:
-
getAccessibleAnnouncer
This interface provides the ability to speak a given string using screen readers.- Returns:
- full implementation of
AccessibleAnnouncerservice if any, ornullotherwise
-
getAccessibleAnnouncer
This interface provides the ability to speak a given string using screen readers.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
AccessibleAnnouncerservice if any, ornullotherwise
-
isDesktopActionsSupported
public static boolean isDesktopActionsSupported()Checks whetherDesktopActionsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
DesktopActionsand its dependencies (can fully implement given service). - See Also:
-
getDesktopActions
Allows desktop actions, like opening a file, or webpage to be overridden.- Returns:
- full implementation of
DesktopActionsservice if any, ornullotherwise - See Also:
-
getDesktopActions
Allows desktop actions, like opening a file, or webpage to be overridden.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
DesktopActionsservice if any, ornullotherwise - See Also:
-
isFontExtensionsSupported
public static boolean isFontExtensionsSupported()Checks whetherFontExtensionsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
FontExtensionsand its dependencies (can fully implement given service). - See Also:
-
getFontExtensions
Font-related utilities.- Returns:
- full implementation of
FontExtensionsservice if any, ornullotherwise
-
getFontExtensions
Font-related utilities.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
FontExtensionsservice if any, ornullotherwise
-
isFontMetricsAccessorSupported
public static boolean isFontMetricsAccessorSupported()Checks whetherFontMetricsAccessorservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
FontMetricsAccessorand its dependencies (can fully implement given service). - See Also:
-
getFontMetricsAccessor
Provides convenience methods to accessFontMetricsinstances, and obtain character advances from them without rounding. Also provides an (unsafe) way to override character advances in those instances with arbitrary specified values.- Returns:
- full implementation of
FontMetricsAccessorservice if any, ornullotherwise
-
getFontMetricsAccessor
Provides convenience methods to accessFontMetricsinstances, and obtain character advances from them without rounding. Also provides an (unsafe) way to override character advances in those instances with arbitrary specified values.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
FontMetricsAccessorservice if any, ornullotherwise
-
isGraphicsUtilsSupported
public static boolean isGraphicsUtilsSupported()Checks whetherGraphicsUtilsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
GraphicsUtilsand its dependencies (can fully implement given service). - See Also:
-
getGraphicsUtils
Graphics2D utilities.- Returns:
- full implementation of
GraphicsUtilsservice if any, ornullotherwise
-
getGraphicsUtils
Graphics2D utilities.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
GraphicsUtilsservice if any, ornullotherwise
-
isHiDPIInfoSupported
public static boolean isHiDPIInfoSupported()Checks whetherHiDPIInfoservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
HiDPIInfoand its dependencies (can fully implement given service). - See Also:
-
getHiDPIInfo
Provides a description of the current desktop operating environment appertaining to hi-DPI properties such as monitor resolutions, scaling, etc.
Note: Supported on Linux (
XToolkit,WLToolkit) only.- Returns:
- full implementation of
HiDPIInfoservice if any, ornullotherwise
-
getHiDPIInfo
Provides a description of the current desktop operating environment appertaining to hi-DPI properties such as monitor resolutions, scaling, etc.
Note: Supported on Linux (
XToolkit,WLToolkit) only.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
HiDPIInfoservice if any, ornullotherwise
-
isJstackSupported
public static boolean isJstackSupported()Checks whetherJstackservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
Jstackand its dependencies (can fully implement given service). - See Also:
-
getJstack
Jstack-related utilities.- Returns:
- full implementation of
Jstackservice if any, ornullotherwise
-
getJstack
Jstack-related utilities.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
Jstackservice if any, ornullotherwise
-
isKeyboardSupported
public static boolean isKeyboardSupported()Checks whetherKeyboardservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
Keyboardand its dependencies (can fully implement given service). - See Also:
-
getKeyboard
JBR API to inspect additional properties of AWT key events and keyboards.- Returns:
- full implementation of
Keyboardservice if any, ornullotherwise
-
getKeyboard
JBR API to inspect additional properties of AWT key events and keyboards.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
Keyboardservice if any, ornullotherwise
-
isNativeRasterLoaderSupported
public static boolean isNativeRasterLoaderSupported()Checks whetherNativeRasterLoaderservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
NativeRasterLoaderand its dependencies (can fully implement given service). - See Also:
-
getNativeRasterLoader
Direct raster loading for VolatileImage.- Returns:
- full implementation of
NativeRasterLoaderservice if any, ornullotherwise
-
getNativeRasterLoader
Direct raster loading for VolatileImage.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
NativeRasterLoaderservice if any, ornullotherwise
-
isProjectorUtilsSupported
public static boolean isProjectorUtilsSupported()Checks whetherProjectorUtilsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
ProjectorUtilsand its dependencies (can fully implement given service). - See Also:
-
getProjectorUtils
GraphicsEnvironment-related utilities.- Returns:
- full implementation of
ProjectorUtilsservice if any, ornullotherwise
-
getProjectorUtils
GraphicsEnvironment-related utilities.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
ProjectorUtilsservice if any, ornullotherwise
-
isRelativePointerMovementSupported
public static boolean isRelativePointerMovementSupported()Checks whetherRelativePointerMovementservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
RelativePointerMovementand its dependencies (can fully implement given service). - See Also:
-
getRelativePointerMovement
Allows getting relative mouse pointer movement.
Note: Supported on Linux and with
WLToolkitonly.- Returns:
- full implementation of
RelativePointerMovementservice if any, ornullotherwise
-
getRelativePointerMovement
Allows getting relative mouse pointer movement.
Note: Supported on Linux and with
WLToolkitonly.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
RelativePointerMovementservice if any, ornullotherwise
-
isRoundedCornersManagerSupported
public static boolean isRoundedCornersManagerSupported()Checks whetherRoundedCornersManagerservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
RoundedCornersManagerand its dependencies (can fully implement given service). - See Also:
-
getRoundedCornersManager
This manager allows decorate awt Window with rounded corners. Appearance depends on operating system.- Returns:
- full implementation of
RoundedCornersManagerservice if any, ornullotherwise
-
getRoundedCornersManager
This manager allows decorate awt Window with rounded corners. Appearance depends on operating system.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
RoundedCornersManagerservice if any, ornullotherwise
-
isScreenshoterSupported
public static boolean isScreenshoterSupported()Checks whetherScreenshoterservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
Screenshoterand its dependencies (can fully implement given service). - See Also:
-
getScreenshoter
Provides a way to take screenshots of an individualWindowwithout involving the operating system's window manager.- Returns:
- full implementation of
Screenshoterservice if any, ornullotherwise
-
getScreenshoter
Provides a way to take screenshots of an individualWindowwithout involving the operating system's window manager.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
Screenshoterservice if any, ornullotherwise
-
isSystemShortcutsSupported
public static boolean isSystemShortcutsSupported()Checks whetherSystemShortcutsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
SystemShortcutsand its dependencies (can fully implement given service). - See Also:
-
getSystemShortcuts
Querying system shortcuts- Returns:
- full implementation of
SystemShortcutsservice if any, ornullotherwise
-
getSystemShortcuts
Querying system shortcuts- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
SystemShortcutsservice if any, ornullotherwise
-
isSystemUtilsSupported
public static boolean isSystemUtilsSupported()Checks whetherSystemUtilsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
SystemUtilsand its dependencies (can fully implement given service). - See Also:
-
getSystemUtils
Extends services provided by java.lang.System and similar.- Returns:
- full implementation of
SystemUtilsservice if any, ornullotherwise
-
getSystemUtils
Extends services provided by java.lang.System and similar.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
SystemUtilsservice if any, ornullotherwise
-
isTextInputSupported
public static boolean isTextInputSupported()Checks whetherTextInputservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
TextInputand its dependencies (can fully implement given service). - See Also:
-
getTextInput
This is a JBR API for text-input related functionality for applications that implement custom text components.Suppose an application implements a custom text component called
CustomTextComponent, that doesn't inherit fromTextComponentorJTextComponent. For this component to work correctly, the application needs to handle certain events that are missing from the Java specification.To do this, the application should add an event listener for the events provided by this API. This is best done at application startup time, since the event listener is global, and not per-component. For example, this would be a proper way to implement this event handler for
CustomTextComponent:
This assumes thatvar textInput = JBR.getTextInput(); if (textInput != null) { textInput.setGlobalEventListener(new TextInput.EventListener() { @Override public void handleSelectTextRangeEvent(TextInput.SelectTextRangeEvent event) { if (event.getSource() instanceof CustomTextComponent) { ((CustomTextComponent)event.getSource()).select(event.getBegin(), event.getBegin() + event.getLength()); } } }); }CustomTextComponenthas a method calledselect, that selects a text range, similar to theTextComponent.select(int, int)andJTextComponent.select(int, int). SeeTextInput.SelectTextRangeEventfor more information.- Returns:
- full implementation of
TextInputservice if any, ornullotherwise
-
getTextInput
This is a JBR API for text-input related functionality for applications that implement custom text components.Suppose an application implements a custom text component called
CustomTextComponent, that doesn't inherit fromTextComponentorJTextComponent. For this component to work correctly, the application needs to handle certain events that are missing from the Java specification.To do this, the application should add an event listener for the events provided by this API. This is best done at application startup time, since the event listener is global, and not per-component. For example, this would be a proper way to implement this event handler for
CustomTextComponent:
This assumes thatvar textInput = JBR.getTextInput(); if (textInput != null) { textInput.setGlobalEventListener(new TextInput.EventListener() { @Override public void handleSelectTextRangeEvent(TextInput.SelectTextRangeEvent event) { if (event.getSource() instanceof CustomTextComponent) { ((CustomTextComponent)event.getSource()).select(event.getBegin(), event.getBegin() + event.getLength()); } } }); }CustomTextComponenthas a method calledselect, that selects a text range, similar to theTextComponent.select(int, int)andJTextComponent.select(int, int). SeeTextInput.SelectTextRangeEventfor more information.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
TextInputservice if any, ornullotherwise
-
isVulkanSupported
public static boolean isVulkanSupported()Checks whetherVulkanservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
Vulkanand its dependencies (can fully implement given service). - See Also:
-
getVulkan
Access to the Vulkan rendering backend, if available.- Returns:
- full implementation of
Vulkanservice if any, ornullotherwise
-
getVulkan
Access to the Vulkan rendering backend, if available.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
Vulkanservice if any, ornullotherwise
-
isWindowDecorationsSupported
public static boolean isWindowDecorationsSupported()Checks whetherWindowDecorationsservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
WindowDecorationsand its dependencies (can fully implement given service). - See Also:
-
getWindowDecorations
Window decorations consist of title bar, window controls and border.- Returns:
- full implementation of
WindowDecorationsservice if any, ornullotherwise - See Also:
-
getWindowDecorations
Window decorations consist of title bar, window controls and border.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
WindowDecorationsservice if any, ornullotherwise - See Also:
-
isWindowMoveSupported
public static boolean isWindowMoveSupported()Checks whetherWindowMoveservice is supported by the runtime.- Returns:
- true if current runtime has implementation for all methods in
WindowMoveand its dependencies (can fully implement given service). - See Also:
-
getWindowMove
X11 WM-assisted window moving facility.- Returns:
- full implementation of
WindowMoveservice if any, ornullotherwise
-
getWindowMove
X11 WM-assisted window moving facility.- Parameters:
extensions- required extensions to enable- Returns:
- full implementation of
WindowMoveservice if any, ornullotherwise
-