OK,
I have a problem. I am using Eclipse 3.0M3, and 1.2.1 beta. I did the following.
1. New SWT Application.
2. Layout Manager -> FormLayout.
3. Add Sash.
4. Add Tree to Sash.
5. Add Table to Sash.
6. Add a couple of buttons below Sash.
Designer generates the following:
- Code: Select all
SashForm sashForm_1;
{
sashForm_1 = new SashForm(shell, SWT.NONE);
sashForm_1.setWeights(new int[] { 1, 1 });
{
new Tree(sashForm_1, SWT.BORDER);
}
{
final Table table = new Table(sashForm_1, SWT.BORDER);
table.setLinesVisible(true);
table.setHeaderVisible(true);
}
final FormData formData = new FormData();
formData.bottom = new FormAttachment(100, -38);
formData.right = new FormAttachment(100, -5);
formData.top = new FormAttachment(0, 5);
formData.left = new FormAttachment(0, 5);
sashForm_1.setLayoutData(formData);
}
The problem is with the call to sashForm_1.setWeights(new int[] { 1, 1 }). This generates a runtime error:
- Code: Select all
java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:2353)
at org.eclipse.swt.SWT.error(SWT.java:2297)
at org.eclipse.swt.custom.SashForm.setWeights(SashForm.java:430)
at tests.TestFormLayout.main(TestFormLayout.java:37)
Exception in thread "main"
I have tried to find the JavaDoc for .setWeights with no luck, so I have no idea what is illegal about the argument, but in any case, I must comment out this line in order to be able to run the generated code.