Hi!
I think I've found two issues with borders.
First issue: When a panel uses Border.Invisible and a title, the title overlaps
with the first row of the content.
Sample code:
Panel panel = new Panel("Panel");
panel.setBorder(new Border.Invisible());
panel.addComponent(new Label("Label 1"));
panel.addComponent(new Label("Label 2"));
panel.addComponent(new Label("Label 3"));
Result:
LaPanel
Label 2
Label 3
Expected:
Label 1
Label 2
Label 3
You could argue that the title should still be shown, but if no title is set
then it looks a little weird. My patch assumes that for an invisible border,
there is no title.
Second issue: When a panel uses Border.Standard, the innerAreaLocation and
innerAreaSize are calculated incorrectly, resulting in the contents being
pushed down by one line and the last line being truncated.
Sample code:
Panel panel = new Panel("Panel");
panel.setBorder(new Border.Standard());
panel.addComponent(new Label("Label 1"));
panel.addComponent(new Label("Label 2"));
panel.addComponent(new Label("Label 3"));
Result:
--Panel----
| |
| Label 1 |
| Label 2 |
-----------
Expected:
--Panel----
| Label 1 |
| Label 2 |
| Label 3 |
-----------
I've attached a patch that resolves these issues. It pushes the responsibility
for drawing the panel title to the Border, as the title forms part of the
window decoration rather than the contents. I felt this worked better for the
invisible border scenario, but I guess it really depends on how you want it to
work there.
I also suspect there'll be issues if a panel title exceeds the dimensions of
the Panel.
Cheers,
Chris.