// check whether the form is a child of a surrounding border
Border border = component.findParent(Border.class);
while ((form == null) && (border != null))
{
FindFormVisitor formVisitor = new FindFormVisitor();
border.visitChildren(Form.class, formVisitor);
form = formVisitor.form;
if (form == null)
{
border = border.findParent(Border.class);
}