On 03/13/2015 11:29 AM, Marko Herchet wrote:
Thanks for your answer. A little research revealed a simple solution for my 
problem I want to share:
As stated in https://geonet.esri.com/thread/70716 using a JApplet between the 
Frame and the SwingComponent fixes the problems.
Following code works like a charm for me (independent of the initial size I 
use):

public class TestSWT
{
     public static void main(final String[] args)
     {
         final Display display = new Display();

         final Shell shell = new Shell(display);
         shell.setSize(800, 200);
         shell.setLayout(new FillLayout());

         createContents(shell);

         shell.open();
         while (!shell.isDisposed()) {
             if (!display.readAndDispatch()) {
                 display.sleep();
             }
         }
         display.dispose();
     }

     private static void createContents(final Composite cmpParent)
     {
         final Composite cmpEmbedded = new Composite(cmpParent, SWT.EMBEDDED);
         final Frame frame = SWT_AWT.new_Frame(cmpEmbedded);

         final JApplet applet = new JApplet();
         final XMLPanel2 xmlPanel = new XMLPanel2();

         frame.setLayout(new GridLayout());

         frame.add(applet);
         applet.add(xmlPanel);
     }
}


Rather unexpected workaround isn't it? Anyway thanks for this tip.


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to