java - SWT GridLayout columns overlap -


code:

final composite sectionclient = toolkit.createcomposite(parent, swt.none); sectionclient.setlayout(uihelper.getlayoutforwidgets(new gridlayout(2, true))); sectionclient.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));  final composite leftcolumncomposite = toolkit.createcomposite(sectionclient); leftcolumncomposite.setlayout(new gridlayout(5, false)); leftcolumncomposite.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));  final composite rightcolumncomposite = toolkit.createcomposite(sectionclient); rightcolumncomposite.setlayout(new gridlayout(5, false)); rightcolumncomposite.setlayoutdata(new griddata(swt.fill, swt.fill, true, true)); 


before:
enter image description here

after:
enter image description here


description:
when window minimized (i.e. user progressively minimizes it), right column overlaps left column. given layout of containers, expect columns not overlap. of widgets become hidden.

what missing? i'm opened different approach on laying out components.


sscce / lots of boiler-plate code (all elements swt):

/**  *   * @author ggrec  *  */ public class ilovepancakes {     private formtoolkit toolkit;      public static void main(final string[] args)     {         new ilovepancakes();     }      private ilovepancakes()      {         final display display = new display();         final shell shell = new shell(display);         shell.setlayout(new gridlayout(1, false));          toolkit = new formtoolkit(display);          createwidgets(shell);          shell.open();         while (!shell.isdisposed())         {             if ( !display.readanddispatch() )                 display.sleep();         }         display.dispose();     }      private void createwidgets(final composite parent)     {         // main section         final section section = toolkit.createsection(parent, expandablecomposite.compact | expandablecomposite.title_bar);         section.settext("main section");         section.setlayout(new gridlayout());         section.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));          // section client         final composite sectionclient = toolkit.createcomposite(section, swt.none);         sectionclient.setlayout(uihelper.getlayoutforwidgets(new gridlayout(2, true)));         sectionclient.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));         section.setclient(sectionclient);          // --------------------- <left column> -----------------------          final composite leftcolumncomposite = toolkit.createcomposite(sectionclient);         leftcolumncomposite.setlayout(new gridlayout(5, false));         leftcolumncomposite.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));          // name         final label label_1 = new label(leftcolumncomposite, swt.none);         label_1.settext("name");         final text namewidget = new text(leftcolumncomposite, swt.border);         namewidget.setlayoutdata(new griddata(swt.fill, swt.fill, true, false, 4, 1));          // p&l         final label label_2 = new label(leftcolumncomposite, swt.none);         label_2.settext("profit , loss");         final combo pnlfilterwidget = new combo(leftcolumncomposite, swt.border);         pnlfilterwidget.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));          // background color         final label label_3 = new label(leftcolumncomposite, swt.none);         label_3.settext("bkg color");         final button bkgcolorselector = new button(leftcolumncomposite, swt.push);         bkgcolorselector.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));          // clear bkgcolor button         final button clearbkgcolorbutton = new button(leftcolumncomposite, swt.push);         clearbkgcolorbutton.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));          // --------------------- <right column> -----------------------          final composite rightcolumncomposite = toolkit.createcomposite(sectionclient);         rightcolumncomposite.setlayout(new gridlayout(5, false));         rightcolumncomposite.setlayoutdata(new griddata(swt.fill, swt.fill, true, true));          // code          final label label_4 = new label(rightcolumncomposite, swt.none);         label_4.settext("code");         final text codewidget = new text(rightcolumncomposite, swt.border);         codewidget.setlayoutdata(new griddata(swt.fill, swt.fill, true, false, 4, 1));          // font style         final label label_5 = new label(rightcolumncomposite, swt.none);         label_5.settext("font style");         final combo fontstylewidget = new combo(rightcolumncomposite, swt.border);         fontstylewidget.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));          // font color         final label label_6 = new label(rightcolumncomposite, swt.none);         label_6.settext("font color");         final button fontcolorselector = new button(rightcolumncomposite, swt.push);         fontcolorselector.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));          // clear fontcolor button         final button clearfontcolorbutton = new button(rightcolumncomposite, swt.push);         clearfontcolorbutton.setlayoutdata(new griddata(swt.fill, swt.fill, true, false));     } } 


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -