Table component does not compute height of rows. If a component has two lines, and another component has one line on the same row, the alignment will be incorrect for the next row.
Here is a small code to reproduce the problem: Window myWindow = new Window("Test table"); Table myTable = new Table(2); myTable.addRow(new Label("Line 1"), new Label("Line 1\nhas\na lot\nof\nlines !")); myTable.addRow(new Label("Line 2"), new Label("Line 2 has just one line")); myWindow.addComponent(myTable);
A workaround for now is to set all component's preferred height to the same value before adding them to the table.
Comment #1
Posted on Apr 20, 2013 by Grumpy OxYes, this is unfortunately a build-in problem with the way I hacked together the initial Table implementation. The whole class needs a re-write, really, I'll put it on the TODO list for the next version.
Comment #2
Posted on Apr 20, 2013 by Grumpy Ox(No comment was entered for this change.)
Comment #3
Posted on Jul 12, 2015 by Grumpy OxThis issue has been closed because Google Code is shutting down shortly and all issues have been migrated, along with the rest of the project, to GitHub. However, notifications will probably not work when updates are made to this issue on GitHub so for future updates, please visit https://github.com/mabe02/lanterna/issues and subscribe to further updates there.
Thank you, Martin
Status: Duplicate
Labels:
Type-Defect
Priority-Medium