I override calcPreferredSize to force a dialog to be larger (for a large
textarea). However it still shows up as a small dialog packed to the
minimum
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);
}
}
--
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/3171d964-4322-4954-a891-db282a232c1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.