I have a dialog that will contain 1 or 2 tables. In the case that there are 2 tables, I need them both to be viewable in the dialog. In the case of 1 table, I only want to see 1 table. I've been using setVisible on the table panels to make them appear and disappear. The problem with this is that when they're is only 1 table present, where the other table is all gray. Is there a way to alter this, so I see only the 1 table and not all the blank gray space and the table?
Thanks for any help. I'm currently using a gridlayout for this, but it's not really what I'm looking for.
try setting the layout to BorderLayout() add table1 to BorderLayout.CENTER add table2 to BorderLayout.EAST (or wherever)
if only table1 is showing, it should occupy all the space if both are showing, table1 will get whatever space is left over from table2's preferredSize, so you may have to tweak table1's preferredSize to match that of table2, if you want both tables to appear the same size