Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在一些单元格内创建一个带有标题的 JTable。但我想将文本与此标题相关联。是否可以?怎么做?
尽我所能!莱安德罗·利马
如果我理解这个问题,那么您可以使用 BorderLayout 创建一个面板。您将表格添加到 CENTER 并将表格标题添加到 NORTH。
table.getColumnModel().getColumn(x).setHeaderValue( "text" );
我发现的唯一方法是创建一个没有单元格和带有标题标题的列的表格。所以我得到这个标题并通过单元格渲染器将它放在其他表中。