我想将添加JTable
到中JScrollPane
,但未显示表头。有人可以帮我解决这个问题吗?
JScrollPane tablePane = new JScrollPane();
tablePane.setViewportView(table);
tablePane.setRowHeaderView(table);
tablePane.setPreferredSize(new Dimension(950, 450));
this.setPreferredSize(new Dimension(1100, 500));
this.setLayout(new BorderLayout());
this.add(BorderLayout.CENTER, tablePane);
下面的代码应该有所帮助。
JScrollPane tablePane = new JScrollPane(table); //tablePane.setViewportView(table); //tablePane.setRowHeaderView(table);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句