Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT_AWT vs. SwingWT
SWT_AWT vs. SwingWT [message #458258] Tue, 12 July 2005 13:14 Go to next message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
I managed to integrate a JLabel and a JButton together with some listeners
into a standard view within eclipse. I wonder what SwingWT provides that
the SWT_AWT bridge can not provide.

Are there any restrictions in using the bridge which made SwingWT
necessary?

Regards,

Ricky
Re: SWT_AWT vs. SwingWT [message #458276 is a reply to message #458258] Tue, 12 July 2005 18:46 Go to previous messageGo to next message
Theo is currently offline TheoFriend
Messages: 3
Registered: July 2009
Junior Member
I managed to integrate a JLabel and a JButton together with some listeners
into a standard view within eclipse. I wonder what SwingWT provides that
the SWT_AWT bridge can not provide.

Are there any restrictions in using the bridge which made SwingWT
necessary?

Regards,

Hi Ricky,
I am trying too to stuff some Swing into a view.
SwingWT was my first choice. Admitedly it comes with plenty
of slick examples, so I thought I've scored.
However soon it became clear that SwingWT deals only with the
GUI sub-area of .awt., for instance there is nothing in
swingwt.awt.geom
or
swingwt.awt.image
So it would be very hard to port a whole working application or applet
to SWT.
I guess the main benefit of using SwingWT is that one would be
able to use familiar Swing snippets and patterns, but again only
as far as it is about GUI components.

Anyway, next I tryed SWT_AWT, but unlike you I wasn't that lucky.
Yes, I can show a button, and the button can even respond with
message(wow),
but every time I change the focus from / to that view an informative
error msg appears: "An error has ocurred when activating that view"
and there is an exception in Eclipse's comsole:

Unhandled event loop exception
Reason:
java.lang.NullPointerException

This is what I do:

public void createPartControl(Composite parent) {

if ( parent == null) return;

Composite comp = new Composite( parent, SWT.EMBEDDED );
Frame frm = SWT_AWT.new_Frame( comp);

final Panel panel = new Panel();
java.awt.Button btn = new java.awt.Button( "OLE !!!");

btn.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog( panel, "Thanks");
}
});

panel.add( btn);
frm.add( panel);
}


Have you experienced such an exception?
Would you mind sharing a snippet?
Cheers,
Theo
Re: SWT_AWT vs. SwingWT [message #458417 is a reply to message #458276] Wed, 13 July 2005 12:41 Go to previous messageGo to next message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
Hi Theo,

> Anyway, next I tryed SWT_AWT, but unlike you I wasn't that lucky.
> Yes, I can show a button, and the button can even respond with
> message(wow),
> but every time I change the focus from / to that view an informative
> error msg appears: "An error has ocurred when activating that view"
> and there is an exception in Eclipse's comsole:

I got an error message too but beeing happy that swing is working within
eclipse, errors will not put me down :)

My code is:

public void createPartControl(Composite parent) {
java.awt.Frame locationFrame = SWT_AWT.new_Frame(new
Composite(parent,parent.getStyle()|SWT.EMBEDDED));
this.label = new JLabel("Hallo Welt");
this.label.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent mouseEvent) {
SampleView.this.label.setText("Hallo Welt
"+mouseEvent.getPoint());
}
});
locationFrame.add(this.label);
}

.... (time flies like an arrow)

The nature of my error was self made as I used the SampleView template to
test the bridge. Like you my createPartControl did not instantiate a
viewer object but the setFocus method accessed one. Hence the Null Pointer
Exception. After commenting out the method, everything worked fine. This
should be read as: No errors in the log. But I still dont know if this
bridge has some big but hidden holes, though.

May this hint help you with your problem? If not the your stacktrace of
the exception would be interesting.

Regards,

Ricky
Re: SWT_AWT vs. SwingWT [message #458418 is a reply to message #458417] Wed, 13 July 2005 12:53 Go to previous message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
One restriction I know of the SWT_AWT bridge is that it is simply not
implemented in eclipse for Mac. Running such a swing-plugin on a Mac
yields in a nasty message saying that something terrible happend to SWT
and that it is adviced to shutdown eclipse.
Previous Topic:Purpose of TreeViewer with TreeColumns vs. TableTreeViewer?
Next Topic:swt-pi-gtk-3138 error
Goto Forum:
  


Current Time: Thu Apr 25 00:33:14 GMT 2024

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

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

Back to the top