package com.howudodat.sdcpmobile.ui;
import com.codename1.ui.Button;
import com.codename1.ui.Dialog;
import com.codename1.ui.FontImage;
import com.codename1.ui.TextArea;
import com.codename1.ui.geom.Dimension;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.spinner.Picker;
import com.codename1.ui.table.TableLayout;
public class DlgClientHistory extends Dialog {
public boolean Cancelled = false;
protected Button btnApply = new Button(FontImage.createMaterial(FontImage.MATERIAL_DONE, UIManager.getInstance().getComponentStyle("Command"), 5));
protected Button btnClose = new Button(FontImage.createMaterial(FontImage.MATERIAL_CLEAR, UIManager.getInstance().getComponentStyle("Command"), 5));
protected Picker cmbDate = new Picker();
protected TextArea taNotes = new TextArea();
protected TableLayout layout = new TableLayout(4,3);
protected FrmClient parent = null;
public DlgClientHistory(FrmClient frm) {
parent = frm;
initManualComponents();
}
protected void initManualComponents() {
// taNotes.setPreferredSize(new Dimension(800, 150));
this.setLayout(layout);
this.setUIID("Form");
this.setDialogUIID("Form");
this.getStyle().setBgTransparency(255);
this.getDialogStyle().setBgTransparency(255);
Container cnt2 = new Container();
cnt2.add(btnApply);
cnt2.add(btnClose);
btnApply.addActionListener(evt -> onApply());
btnClose.addActionListener(evt -> onClose());
add(layout.createConstraint().horizontalSpan(3).horizontalAlign(Component.RIGHT), cnt2);
add(layout.createConstraint().horizontalSpan(1).horizontalAlign(Component.RIGHT), new Label("Date:"));
add(layout.createConstraint().horizontalSpan(1), cmbDate);
add(layout.createConstraint().horizontalSpan(1), new Label());
add(layout.createConstraint().horizontalSpan(3), taNotes);
}
@Override
protected Dimension calcPreferredSize() {
// TODO Auto-generated method stub
return new Dimension(800, 500);
}
}
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();
}
}
What matters is the preferred size of its content.
protected TextArea taNotes = new TextArea() {
@Override
protected Dimension calcPreferredSize() {
return new Dimension(800, 500);
}
};
taNotes.setPreferredSize(new Dimension(800,500));