Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Embedded SWT_AWT EventQueue Exceptions
Embedded SWT_AWT EventQueue Exceptions [message #462695] Mon, 17 October 2005 12:55
Bob Brady is currently offline Bob BradyFriend
Messages: 28
Registered: July 2009
Junior Member
Hi All,

I found that when embedding an AWT frame into an SWT Group that I get
EventQueue NullPointerExceptions. However, if I simply wrap the SWT_AWT
Frame inside a Composite, the error goes away. I suspect that the
SWT_AWT Frame has to be a directly attached to a Composite and that using a
subclass of Composite doesn't work. Has anyone experienced this
before? Is this a bug? Do you agree that every SWT_AWT Frame should
be directly contained within a Composite and not one of Composite's
subclasses? Thanks and details below

-Bob

Here is the snippet used for the Group case:

awtBridgeGroup = new Group (parentGroup, SWT.EMBEDDED);
awtBridgeGroup.setLayout (new GridLayout ());
awtBridgeGroup.setLayoutData (new GridData (GridData.FILL_BOTH));
awtBridgeGroup.setText ("Awt Bridge");
awtBridgeGroup.setSize (300, 300);

awtTopFrame = SWT_AWT.new_Frame (awtBridgeGroup);


and for the Composite wrapper case:

awtBridgeGroup = new Group (parentGroup, SWT.EMBEDDED);
awtBridgeGroup.setLayout (new GridLayout ());
awtBridgeGroup.setLayoutData (new GridData (GridData.FILL_BOTH));
awtBridgeGroup.setText ("Awt Bridge");
awtBridgeGroup.setSize (300, 300);


Composite embeddedComposite = new
Composite(awtBridgeGroup,SWT.EMBEDDED);
embeddedComposite.setLayout(new GridLayout());
embeddedComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
embeddedComposite.setSize(awtBridgeGroup.getSize().x-5,
awtBridgeGroup.getSize().y -5);

awtTopFrame = SWT_AWT.new_Frame (embeddedComposite);


If I don't use a composite wrapper, then I get the exception below
when closing the window. For some reason using a subclass of
Composite to contain the SWT_AWT Frame doesn't kill off the
WComponentPeer in the AWT EventQueue?

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException:
null pData
at sun.awt.windows.WComponentPeer.hide(Native Method)
at java.awt.Component.hide(Component.java:1336)
at java.awt.Window.hide(Window.java:565)
at sun.awt.EmbeddedFrame.hide(EmbeddedFrame.java:176)
at java.awt.Window$1DisposeAction.run(Window.java:627)
at java.awt.Window.doDispose(Window.java:641)
at java.awt.Window.dispose(Window.java:596)
at org.eclipse.swt.awt.SWT_AWT$2.run(SWT_AWT.java:164)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java :209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventD ispatchThread.java:242)
Previous Topic:Folding??
Next Topic:Browser.execute()
Goto Forum:
  


Current Time: Sat Oct 24 14:46:22 GMT 2020

Powered by FUDForum. Page generated in 0.01741 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top