我想用 defaulttablemodel BOLD 制作 jtable 的标题。这是我的代码
class TablePanel extends JPanel {
private String[] COLUMNS = {"FAMILY MEMBERS", "STAR (NAKSHATRA)"};
private DefaultTableModel model = new DefaultTableModel(COLUMNS, 0){
public boolean isCellEditable(int row, int column) {
return false;
}
};
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(){
public void setHorizontalAlignment(int alignment) {
alignment = (int) CENTER_ALIGNMENT;
};
};
public JTable table = new JTable(model){
public void setDefaultRenderer(java.lang.Class<?> columnClass, TableCellRenderer renderer) {
columnClass= String.class;
renderer=centerRenderer;
};
public void setBackground(Color bg) {
bg = Color.yellow;
};
};
我想让列标题加粗。对此的任何提示表示赞赏