And the problems keep getting weirder. Now the 4th column is disappearing.
Here is a complete test app you can copy / paste. Click on test1 and you
see all 4 columns, click on test2 and the 4th column disappears. The
difference is a textfield is in test2
public class FrmMain extends Form {
public FrmMain() {
initManualComponents();
}
protected void initManualComponents() {
this.setLayout(new BorderLayout());
Button btn = new Button("Test");
btn.addActionListener(evt -> onClick());
this.add(BorderLayout.NORTH, btn);
Button btn2 = new Button("Test2");
btn2.addActionListener(evt -> onClick2());
this.add(BorderLayout.SOUTH, btn2);
}
protected void onClick() {
new MyDlg().show();
}
protected void onClick2() {
new MyDlg2().show();
}
class MyDlg extends Dialog {
protected Button btnClose = new
Button(FontImage.createMaterial(FontImage.MATERIAL_CLEAR,
UIManager.getInstance().getComponentStyle("TitleCommand")));
public MyDlg() {
initManualComponents();
}
protected void initManualComponents() {
this.setLayout(new BorderLayout());
this.getDialogStyle().setBgColor(0xFF0000);
this.getStyle().setBgColor(0xFF0000);
this.getContentPane().getStyle().setBgColor(0xFF0000);
btnClose.addActionListener(evt -> dispose());
TableLayout layout = new TableLayout(10,4);
Container cnt1 = new Container(layout);
cnt1.add(layout.createConstraint().horizontalSpan(4).horizontalAlign(Component.RIGHT),
btnClose);
cnt1.add(layout.createConstraint().widthPercentage(15), new
Label("A"));
cnt1.add(layout.createConstraint().widthPercentage(35), new
Label("B"));
cnt1.add(layout.createConstraint().widthPercentage(35), new
Label("C"));
cnt1.add(layout.createConstraint().widthPercentage(15), new
Label("D"));
cnt1. add(layout.createConstraint().horizontalSpan(2), new
Label("Span 2"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("A"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
cnt1.add(layout.createConstraint().horizontalSpan(3), new
Label("Span 3"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label(""));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("Span 1"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("Span 1"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
this.add(BorderLayout.CENTER, cnt1);
}
}
class MyDlg2 extends Dialog {
protected Button btnClose = new
Button(FontImage.createMaterial(FontImage.MATERIAL_CLEAR,
UIManager.getInstance().getComponentStyle("TitleCommand")));
public MyDlg2() {
initManualComponents();
}
protected void initManualComponents() {
this.setLayout(new BorderLayout());
this.getDialogStyle().setBgColor(0xFF0000);
this.getStyle().setBgColor(0xFF0000);
this.getContentPane().getStyle().setBgColor(0xFF0000);
btnClose.addActionListener(evt -> dispose());
TableLayout layout = new TableLayout(10,4);
Container cnt1 = new Container(layout);
cnt1.add(layout.createConstraint().horizontalSpan(4).horizontalAlign(Component.RIGHT),
btnClose);
cnt1.add(layout.createConstraint().widthPercentage(15), new
Label("A"));
cnt1.add(layout.createConstraint().widthPercentage(35), new
Label("B"));
cnt1.add(layout.createConstraint().widthPercentage(35), new
Label("C"));
cnt1.add(layout.createConstraint().widthPercentage(15), new
Label("D"));
cnt1. add(layout.createConstraint().horizontalSpan(2), new
Label("Span 2"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("A"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
cnt1.add(layout.createConstraint().horizontalSpan(3), new
Label("Span 3"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label(""));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("Span 1"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("Span 1"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label(""));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("Span 1"));
cnt1.add(layout.createConstraint().horizontalSpan(1), new
TextField());
cnt1.add(layout.createConstraint().horizontalSpan(1), new
Label("X"));
this.add(BorderLayout.CENTER, cnt1);
}
}
}
And the results of clicking test1 and test2:
<https://lh3.googleusercontent.com/-zn-t3vjdu6Y/V5YuHgob31I/AAAAAAAAEHg/rnVAv8JADPs3xdzh6scyiyW-VDQdHne5gCLcB/s1600/Screenshot%2Bfrom%2B2016-07-25%2B08-18-08.png>
--
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/5ec9f887-1dd8-4edf-8c23-ccf0a0bb2eda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.