JGoodies: What is the nextLine() equivalent in FormBuilder

311 Views Asked by At

DefaultFormBuilder has been deprecated in version of JGoodies 1.9.0. The suggested alternative is FormBuilder.

Old code using DefaultFormBuilder:

builder.appendSeparator("Autoset");
builder.append(description);
builder.nextLine();

New code using FormBuilder:

builder.addSeparator("Autoset").xy(1, 1);
builder.add(description).xy(1, 3);

Note that the positions of the added elements have to be explicitly given. Is this really necessary? Is there any equivalent of append() (without coordinates) and nextLine()?

1

There are 1 best solutions below

1
Karsten Lentzsch On

I've found that the DefaultFormBuilder has been widely abused in the projects I worked in. It was intended for very simple forms only. Often developers have added cursor operations that ended up in code that is hard to read - and needs two passes to understand the overall layout.

Therefore it has been deprecated.

The FormBuilder code should read:

FormBuilder.create()
.columns("...")
.rows("...")
.addSeparator("Autoset").xy(1, 1)
.add(description) .xy(1, 3)
.build();