This is so frustrating...
Which component does the preferred size need to be set on?  Here is a VERY 
SIMPLE test case.  Look at it, use it, test it, then please explain what's 
wrong.  It respects the preferred height but not width.

<https://lh3.googleusercontent.com/-4ox9yNbQCqQ/V-aQuAWgZaI/AAAAAAAAEU0/qD_YV8dt2eMCemGLtfPlci-aMMK9gBdSgCLcB/s1600/Screenshot%2Bfrom%2B2016-09-24%2B07-41-01.png>
package com.mycompany.myapp;


import com.codename1.ui.Button;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Dialog;
import com.codename1.ui.FontImage;
import com.codename1.ui.Label;
import com.codename1.ui.TextArea;
import com.codename1.ui.geom.Dimension;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.table.TableLayout;


public class DlgClientFilter extends Dialog {
 protected TableLayout layout = new TableLayout(10,3);
 protected Button btnApply = new Button(FontImage.createMaterial(FontImage.
MATERIAL_DONE, UIManager.getInstance().getComponentStyle("Command"), 5));


 protected TextArea taNotes = new TextArea() {


 @Override
 protected Dimension calcPreferredSize() {
 return new Dimension(800, 500);
 }
 
 };


 public DlgClientFilter() {
        initManualComponents();
    }
    
    protected void initManualComponents() {
    this.setLayout(layout);


    taNotes.setPreferredSize(new Dimension(800, 500));
        
    Container content = getContentPane();
        content.add(layout.createConstraint().widthPercentage(33), new Label
(""));
        content.add(layout.createConstraint().widthPercentage(33), new Label
(""));
        content.add(layout.createConstraint().widthPercentage(33), new Label
(""));


    Container cnt2 = new Container();
    cnt2.add(btnApply);
    btnApply.addActionListener(evt -> onApply());
    content.add(layout.createConstraint().horizontalSpan(3).horizontalAlign(
Component.RIGHT), cnt2);
    content.add(layout.createConstraint().horizontalSpan(3), taNotes);


    }
    
    protected void onApply() {
      dispose();
    }
    
}


On Friday, September 23, 2016 at 10:57:36 PM UTC-7, Shai Almog wrote:
>
> It is. You are setting the preferred size to the wrong component.
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/57cc4125-50a4-4ae6-8a16-d95a170ed437%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to