Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326255

Summary: SWT_AWT bridge - SWT in Swing problem
Product: [Eclipse Project] Platform Reporter: amos <mountain14466>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: akurtakov, remy.suen
Version: 4.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description amos CLA 2010-09-26 02:06:08 EDT
Build Identifier: 

I wanted to embed brower into awt canvas.I wrote 
public class MyBrowser{  

   public static void main(String[] args)  
   {  
       final Display display = Display.getDefault();  

       Frame frm = new Frame("MyBrowser");  
       Canvas embedded = new Canvas();  
       frm.add(embedded, BorderLayout.CENTER);  

       frm.pack();  

       final Shell composite = SWT_AWT.new_Shell(display, embedded);  
       composite.setLayout(new FillLayout(SWT.VERTICAL));  
       final Browser browser = installBrowser(composite,
"http://www.baidu.com");  
       frm.addWindowListener(new WindowAdapter()  
       {  
           public void windowClosing(WindowEvent e)  
           {  
           e.getWindow().dispose();  
           //composite.dispose();  
//            display.dispose();  
           }  
       });  

       JTextField addr = new JTextField(80);  
       addr.addActionListener(new ActionListener()  
       {  
           public void actionPerformed(final ActionEvent e)  
           {  
               display.syncExec(new Runnable()  
               {  
                   public void run()  
                   {  
                       browser.setUrl(((JTextComponent)
e.getSource()).getText());  
                   }  
               });  
           }  
       });  
       frm.add(addr, BorderLayout.NORTH);  

       frm.setSize(800, 600);  
       frm.setVisible(true);  
       while (frm.isDisplayable())  
           if (!display.readAndDispatch())  
               display.sleep();  
//       display.dispose();  
   }  

   public static Browser installBrowser(Composite parent, String homeURL)  
   {  
       Browser browser = new Browser(parent, SWT.EMBEDDED);  
       browser.setUrl(homeURL);  
       return browser;  
   }  
}  
On Windows it works, 
On Linux, the bridge seems to work, but nothing is visible. So I want to know
how to make it work on linux. Just swt browser component is OK.When embed it
into awt-canvas. it can not work 

My environment is :¡¡£í£ï£ú£é£ì£ì£á 1.7.7 gtk: gtk2-2.2.4-19 linux: Red Hat
Enterprise Linux ES release 3 (Taroon Update 8) uname -a 2.4.21-47.ELsmp #1 SMP
Wed Jul 5 20:38:41 EDT 2006 i686 i686 i386 GNU/Linux

Reproducible: Always
Comment 1 Remy Suen CLA 2010-09-26 07:46:23 EDT
Is this the same problem as bug 326117?
Comment 2 amos CLA 2010-09-26 21:40:17 EDT
yes. It is the same as bug 326117. I am sorry for deliver it three times. You can close it. 
Could you give me some suggestion about 326117? how can I embed the browser into awt.
Comment 3 Alexander Kurtakov CLA 2014-07-10 06:53:44 EDT

*** This bug has been marked as a duplicate of bug 326117 ***