centrar valores en celda jtable java netbeans
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
public class JTableUtilities
{
public static void setCellsAlignment(JTable table, int alignment)
{
DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
rightRenderer.setHorizontalAlignment(alignment);
TableModel tableModel = table.getModel();
for (int columnIndex = 0; columnIndex < tableModel.getColumnCount(); columnIndex++)
{
table.getColumnModel().getColumn(columnIndex).setCellRenderer(rightRenderer);
}
}
}