public interface IJCGraphicContainer
Implementations wrap a JVM graphical object and expose the lifecycle hooks, layout callbacks, and window management operations needed by the CLR host to position, resize, show, hide, and interact with the embedded window.
The interface supports three optional capabilities that implementations may choose to provide:
isRemoteManaged()) — the implementation
takes over native window style management, stripping decorations and applying
child-window behavior so the CLR host can embed it as a true child window.hasMeasureOverride()) — the implementation
participates in the CLR layout pass by reporting its preferred size.hasWndProcHandler()) — the implementation
intercepts Windows messages forwarded by the CLR host.JCOBridge provides a default AWT/Swing implementation via
JCOBridge.CreateContainer(java.awt.Component) and
JCOBridge.CreateContainer(String).
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Called by the CLR host when the embedded window is being torn down.
|
void |
endMeasureOverride()
Called by the CLR layout engine at the end of a measure pass.
|
Object |
getGraphicObject()
Returns the JVM graphical object hosted inside this container.
|
int |
getMeasureOverrideHeight()
Returns the preferred height measured by this implementation during the last
measure override pass.
|
int |
getMeasureOverrideWidth()
Returns the preferred width measured by this implementation during the last
measure override pass.
|
long |
getNativeWindowHandle()
Returns the native window handle (HWND on Windows) of the JVM component hosted
inside this container.
|
boolean |
hasFocusWithinCore()
Returns whether this container currently owns the keyboard focus.
|
boolean |
hasMeasureOverride()
Returns
true if this implementation participates in the CLR layout
measure pass by reporting a preferred size via
getMeasureOverrideWidth() and getMeasureOverrideHeight(). |
boolean |
hasWndProcHandler()
Returns
true if this implementation intercepts Windows messages
forwarded by the CLR host via wndProcHandler(long, int, long, long, boolean). |
void |
initialize(long hwndHost)
Called by the CLR host after the native window infrastructure is ready.
|
boolean |
isRemoteManaged()
Returns
true if this implementation takes over native window style
management and window placement. |
void |
setSizeAndVisibility(boolean isVisible,
int x,
int y,
int width,
int height)
Called by the CLR host to update the visibility and bounding rectangle of the
embedded JVM window.
|
void |
startMeasureOverride(int width,
int height)
Called by the CLR layout engine at the start of a measure pass, providing the
available size constraints.
|
boolean |
wndProcHandler(long hwnd,
int msg,
long wParam,
long lParam,
boolean handled)
Called by the CLR host to forward a Windows message to this implementation.
|
void initialize(long hwndHost)
hwndHost - the HWND of the CLR host window; available for implementations
that need to reparent the JVM window as a native child.void destroy()
boolean isRemoteManaged()
true if this implementation takes over native window style
management and window placement.
A true implementation is expected to remove the following Win32 styles
from the hosted window's HWND: WS_CAPTION | WS_THICKFRAME |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU, and to apply
WS_CHILDWINDOW so the window behaves as a true child of the CLR host.
When this returns false, the CLR host manages positioning externally
via setSizeAndVisibility(boolean, int, int, int, int).
true if this implementation manages embedding styles and placement.void setSizeAndVisibility(boolean isVisible,
int x,
int y,
int width,
int height)
isVisible - true to make the window visible.x - the x-coordinate of the left edge of the bounding rectangle.y - the y-coordinate of the top edge of the bounding rectangle.width - the width of the bounding rectangle in pixels.height - the height of the bounding rectangle in pixels.boolean hasMeasureOverride()
true if this implementation participates in the CLR layout
measure pass by reporting a preferred size via
getMeasureOverrideWidth() and getMeasureOverrideHeight().true if measure override is supported.void startMeasureOverride(int width,
int height)
hasMeasureOverride() returns
true.width - the available width constraint from the CLR layout pass, in pixels.height - the available height constraint from the CLR layout pass, in pixels.int getMeasureOverrideWidth()
hasMeasureOverride() returns
true.int getMeasureOverrideHeight()
hasMeasureOverride() returns
true.void endMeasureOverride()
hasMeasureOverride() returns true.boolean hasWndProcHandler()
true if this implementation intercepts Windows messages
forwarded by the CLR host via wndProcHandler(long, int, long, long, boolean).true if WndProc interception is supported.boolean wndProcHandler(long hwnd,
int msg,
long wParam,
long lParam,
boolean handled)
hasWndProcHandler() returns true.hwnd - the window handle of the hosted child window.msg - the Windows message identifier.wParam - the WPARAM value — typically small flags or indices.lParam - the LPARAM value — typically a pointer or object reference.handled - the handled flag from the original CLR WndProc call.true if this implementation handled the message and no further
processing should occur; false to allow the CLR host to
continue default processing.boolean hasFocusWithinCore()
true if this container is the current focus owner.long getNativeWindowHandle()
0 if not yet available.Object getGraphicObject()
Component or
Swing JComponent.