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

Bug 326254

Summary: SWT_AWT bridge - SWT in Swing problem
Product: [Eclipse Project] JDT Reporter: amos <mountain14466>
Component: CoreAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: mountain14466, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
compare window with linux none

Description amos CLA 2010-09-26 02:01:43 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 amos CLA 2010-09-26 02:03:22 EDT
Created attachment 179581 [details]
compare window with linux

compare window with linux
Comment 2 Remy Suen CLA 2010-09-26 07:46:10 EDT
Is this the same problem as bug 326117?
Comment 3 amos CLA 2010-09-26 21:41:12 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.

*** This bug has been marked as a duplicate of bug 326117 ***
Comment 4 Satyam Kandula CLA 2010-09-27 00:42:46 EDT
Moving to SWT