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.
这是我的桌子:
我喜欢这样,61并且29在2013/09/20牢房中间,而不是在左侧!
61
29
2013/09/20
怎么办?
您可以这样做,通过覆盖渲染器来设置每列的水平对齐方式。
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(JLabel.CENTER); for(int i = 0; i < columnCount; i++){ table.getColumnModel().getColumn(i).setCellRenderer(render); }