Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## chrriis.dj.nativeswing
Class NativeComponentWrapper

    java.lang.Object
      chrriis.dj.nativeswing.NativeComponentWrapper

    public class NativeComponentWrapper

extends Object

A wrapper for a native component, so that it becomes part of the Native Swing framework. This class should be used by developers who want to have some native component be properly integrated in Swing applications.

Author:
  Christopher Deckers

Constructor Summary
`NativeComponentWrapper(Component nativeComponent)` Construct a NativeComponentWrapper.

Method Summary
`void` | `createBackBuffer()` Create an image of the native peer as a back buffer, which can be used when painting the component, or to simulate alpha blending.
`Component` | `createEmbeddableComponent(Map<Object,Object> optionMap)` A native component instance cannot be added directly to a component hierarchy: this method creates a component that will host the native component but which can be added to the component hierarchy.
`Component` | `createEmbeddableComponent(NSOption... options)` A native component instance cannot be added directly to a component hierarchy: this method creates a component that will host the native component but which can be added to the component hierarchy.
`void` | `destroyBackBuffer()` Destroy the back buffer.
`void` | `disposeNativeComponent()` Explicitely dispose the native resources.
`protected String` | `getComponentDescription()` Get a description of this component wrapper, which is used for example to improve debug messages.
`void` | `paintBackBuffer(Graphics g)` Paint the back buffer, if one was created, to a graphic context.
`protected void` | `paintNativeComponent(BufferedImage image, Rectangle[] rectangles)` Paint the native component including its native peer in an image, in the areas that are specified.
`protected void` | `setNativeComponentEnabled(boolean isEnabled)` This method is invoked to enable or disable the native component at its native level, to prevent focus and input problems.
`void` | `transferFocus(boolean isForward)` This method should be invoked by the native component when it wants to transfer the focus.
`void` | `updateBackBuffer(Rectangle[] rectangles)` Update (eventually creating an empty one if it does not exist) the back buffer on the area specified by the rectangles.
`void` | `updateBackBufferOnVisibleTranslucentAreas()` Update the back buffer on the areas that have non opaque overlays and that are not covered by opaque components.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NativeComponentWrapper

    public NativeComponentWrapper(Component nativeComponent)

  Construct a NativeComponentWrapper.

  Parameters:
    `nativeComponent` - the native component to wrap.

Method Detail

### paintNativeComponent

    protected void paintNativeComponent(BufferedImage image,
                                        Rectangle[] rectangles)

  Paint the native component including its native peer in an image, in the areas that are specified. This method can be called from a non-UI thread.

  Parameters:
    `image` - the image to paint to.
    `rectangles` - the area in which the component should be painted, or null to paint everything.

### setNativeComponentEnabled

    protected void setNativeComponentEnabled(boolean isEnabled)

  This method is invoked to enable or disable the native component at its native level, to prevent focus and input problems. It does nothing by default but should be implemented when possible.

  Parameters:
    `isEnabled` - true if the native component should be enabled, false otherwise.

### getComponentDescription

    protected String getComponentDescription()

  Get a description of this component wrapper, which is used for example to improve debug messages.

  Returns:
    a description of this component wrapper.

### createEmbeddableComponent

    public Component createEmbeddableComponent(NSOption... options)

  A native component instance cannot be added directly to a component hierarchy: this method creates a component that will host the native component but which can be added to the component hierarchy.

  Parameters:
    `options` - the options to configure the behavior of this component.
  Returns:
    the component that contains the native component and that can be added to the component hierarchy.

### createEmbeddableComponent

    public Component createEmbeddableComponent(Map<Object,Object> optionMap)

  A native component instance cannot be added directly to a component hierarchy: this method creates a component that will host the native component but which can be added to the component hierarchy.

  Parameters:
    `optionMap` - the options to configure the behavior of this component.
  Returns:
    the component that contains the native component and that can be added to the component hierarchy.

### disposeNativeComponent

    public void disposeNativeComponent()

  Explicitely dispose the native resources. This is particularly useful if deferred destruction is used (cf native component options) and the component is not going to be used anymore.

### paintBackBuffer

    public void paintBackBuffer(Graphics g)

  Paint the back buffer, if one was created, to a graphic context.

  Parameters:
    `g` - the graphic context to paint to.

### createBackBuffer

    public void createBackBuffer()

  Create an image of the native peer as a back buffer, which can be used when painting the component, or to simulate alpha blending.

### updateBackBufferOnVisibleTranslucentAreas

    public void updateBackBufferOnVisibleTranslucentAreas()

  Update the back buffer on the areas that have non opaque overlays and that are not covered by opaque components.

### updateBackBuffer

    public void updateBackBuffer(Rectangle[] rectangles)

  Update (eventually creating an empty one if it does not exist) the back buffer on the area specified by the rectangles.

  Parameters:
    `rectangles` - the area to update.

### destroyBackBuffer

    public void destroyBackBuffer()

  Destroy the back buffer.

### transferFocus

    public void transferFocus(boolean isForward)

  This method should be invoked by the native component when it wants to transfer the focus.

  Parameters:
    `isForward` - true if the focus should be transfered forward, false if it should be backward.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD