Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] AWT Native Interface.


Just create a bugzilla report and attach the code.  Don't worry to much about integrating for now.  That way, we can see quickly what you have done.



"Di Iorio, Matthew (ISS Atlanta)" <MDiIorio@xxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

07/07/2003 01:17 PM
Please respond to platform-swt-dev

       
        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        RE: [platform-swt-dev] AWT Native Interface.



I would be happy to.  The solution requires a bit of C code to interface with the JAWT library.  I have the code worked out for Win32, but I don't think it will be too much different for Linux.
 
I just hacked up my own swt.jar to get it working, so it will take a bit more work to get it integrated into the SWT project.  I'll need to learn the SWT project structure better before I can produce a patch.  I'll look into it over the next couple weeks.
 
Matt
-----Original Message-----
From:
Steve Northover [mailto:Steve_Northover@xxxxxxxxxx]
Sent:
Monday, July 07, 2003 11:34 AM
To:
platform-swt-dev@xxxxxxxxxxx
Cc:
'platform-swt-dev@xxxxxxxxxxx'; platform-swt-dev-admin@xxxxxxxxxxx
Subject:
RE: [platform-swt-dev] AWT Native Interface.


Mathew, want to contribute to fixing SWT_AWT for 1.4?  Is it just a matter of looking for JAWT_DrawingSurface in the code or are C natives required?



"Norton, Christopher" <Christopher.Norton@xxxxxxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

07/07/2003 11:20 AM
Please respond to platform-swt-dev

       
       To:        "'platform-swt-dev@xxxxxxxxxxx'" <platform-swt-dev@xxxxxxxxxxx>

       cc:        

       Subject:        RE: [platform-swt-dev] AWT Native Interface.




Thanks Matt.  Everything works great now.

Chris

-----Original Message-----
From: Di Iorio, Matthew (ISS Atlanta) [mailto:MDiIorio@xxxxxxx]
Sent: Thursday, July 03, 2003 2:25 PM
To: platform-swt-dev@xxxxxxxxxxx
Subject: RE: [platform-swt-dev] AWT Native Interface.


A component needs to be visible before you can get the hwnd for it.  Add the
canvas to your component hierarchy and make the top-level window visible
before calling new_Shell.  In my code I override addNotify and call
new_Shell from there.  Also, I call new_Shell from the SWT event thread,
which may or may not be necessary.

I've updated the zip with SwtEventThread.java, which I use in the code
below.

-----

public class BrowserPanel extends Panel {
               private Canvas browserCanvas;

               public BrowserPanel() {
                                browserCanvas = new Canvas();
                                add( browserCanvas );
                                // now add this Panel to your Frame (or JFrame) and call
frame.setVisible(true)
               }

               // gets called when component is realized
               public void addNotify() {
                                super.addNotify();
                                createBrowserOnSwtEventThread();
               }

               private void createBrowserOnSwtEventThread() {
                   display = SwtEventThread.getDisplay();
                   display.syncExec( new Runnable() {
                                                 public void run() {
                                                                  createBrowser();
                                                 }
                                } );
               }                                  

               /**
                * Do not call this method directly.  Call
createBrowserOnSwtEventThread instead.
                */
               private void createBrowser() {
                                shell =
org.eclipse.swt.internal.awt.win32.SWT_AWT.new_Shell(display,
browserCanvas);
                                ...
               }
}

-----Original Message-----
From: Norton, Christopher [mailto:Christopher.Norton@xxxxxxxxxxxxxxxx]
Sent: Thursday, July 03, 2003 11:57 AM
To: 'platform-swt-dev@xxxxxxxxxxx'
Subject: RE: [platform-swt-dev] AWT Native Interface.



Matt,

I downloaded and unziped the file then added the swt jar and dll files
location to the classpath and java.library.path respectively.  However when
I run my simple button example to display a AWT, Swing, and SWT button I get
the following error.

org.eclipse.swt.SWTException: Error locking surface
               at
org.eclipse.swt.internal.awt.win32.SWT_AWT.getHwndForCanvas(Native Method)
               at org.eclipse.swt.internal.awt.win32.SWT_AWT.new_Shell(Unknown
Source)
               at org.jfree.chart.demo.AWTButton.run(AWTButton.java:79)
               at org.jfree.chart.demo.AWTButton.main(AWTButton.java:42)
Exception in thread "main"

What am I doing wrong?  Is there a setting that I could have missed. I'm
running Win2k, Eclipse IDE, jdk 1.4.1_01.

Thanks for your help,

Chris

-----Original Message-----
From: Di Iorio, Matthew (ISS Atlanta) [mailto:MDiIorio@xxxxxxx]
Sent: Thursday, July 03, 2003 11:04 AM
To: platform-swt-dev@xxxxxxxxxxx
Subject: RE: [platform-swt-dev] AWT Native Interface.


I've got a Win32 implementation at
http://www.pobox.com/~doo/SWT_AWT_Win32.zip.  The swt.jar in the zip has
been modified to use my SWT_AWT class.  This means you will have to use the
2122 version of SWT included in the zip, or rebuild swt.jar if you want to
use a newer version.

Matt

-----Original Message-----
From: Norton, Christopher [mailto:Christopher.Norton@xxxxxxxxxxxxxxxx]
Sent: Thursday, July 03, 2003 8:11 AM
To: 'platform-swt-dev@xxxxxxxxxxx'
Subject: [platform-swt-dev] AWT Native Interface.


Hi,

I don't know if this is the right forum or not but I've been attempting to
use the experimental SWT_AWT class to use both SWT and Swing from within the
same java frame.  I've narrowed my problems down to the DrawingSurface class
which has changed in JDK 1.4 and the current SWT_AWT class still attempts to
access the old DrawingSurface.  I did some investigating and I found out
that the new AWT Native Interface appears to be similar and the new class is
named JAWT_DrawingSurface.

Are there any plans to update the SWT_AWT class to use the new AWT Native
Interface?

I would attempt to do this myself but I don't know the effort level and I
don't have access to a C++ compiler.

Thanks for any feedback,


Chris
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev





Back to the top