skip to main content
Programmers documentation > Graphic components > Using JViews products in Eclipse RCP applications > The bridge between AWT/Swing and SWT
 
The bridge between AWT/Swing and SWT
The bridge between the AWT/Swing windowing system and the SWT windowing system consists of an IlvSwingControl class that encapsulates a Swing JComponent in an SWT widget. This class allows you to use IlpNetwork, IlpEquipment, IlpTree, and IlpTable objects in an SWT window, together with other SWT or JFace controls.
The following code shows how to create a bridge object:
 
Composite parent = ...;
IlpNetwork network = new IlpNetwork();
ControlSWTnetwork = new IlvSwingControl(parent, SWT.NONE, network);
At the JViews Framework level, the bridge between the AWT/Swing windowing system and the SWT windowing system consists of an IlvSwingControl class that encapsulates a Swing JComponent in an SWT widget. This class allows you to use IlvManager or IlvJManagerViewPanel objects in an SWT window, together with other SWT or JFace controls.
The following code shows how to create a bridge object at the JViews Framework level:
Composite parent = ...;
IlvManagerView mgrView = ...;
IlvJManagerViewPanel jmgrView = new IlvJManagerViewPanel(mgrView);
ControlSWTview = new IlvSwingControl(parent, SWT.NONE, jmgrView);
Using IlvSwingControl instead of the native SWT_AWT class has the following benefits:
*Simplicity: it is easier to use, since you do not have to worry about the details of the Component hierarchy (see http://java.sun.com/javase/7/docs/api/java/awt/Component.html).
*Portability: IlvSwingControl also works on platforms that do not have SWT_AWT, like X11/Motif® and MacOS® X 10.4.
*Less flickering: on Linux®/Gtk, flickering is reduced.
*Pop-up menus: pop-up menus can be positioned on each Component inside the AWT component hierarchy. For details of components, see http://java.sun.com/javase/7/docs/api/java/awt/Component.html.
*Better size management: the size management between SWT and AWT (LayoutManager) is integrated.
*Focus: it provides a workaround for a focus problem on Microsoft® Windows® platforms.
NOTE >> The IlvSwingControl bridge is not supported on all platforms. It is only supported on Windows, UNIX® with X11 (Linux, Solaris™, AIX®, HP-UX®), and MacOS X 10.4 or later.
The IlvSwingControl bridge does not support arbitrary JComponents. Essentially, components that provide text editing are not supported. See IlvSwingControl for a precise description of the limitations.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.