There are more problems than just getting the color and border of the table title. Each cell / column is displayed with a TableCellRenderer , meaning that the values returned by the UIManager can be ignored ...
For example, the following displays a JTableHeader and applies a border / background to a JLabel based on the values returned by the UIManager under the Look and Feel ...

As you can see, there is a difference between them.
Be that as it may, if everything you are interested in displays a "group header" of some kind on top of another component in the scroll bar, you can simply add a JTableHeader to the scroll column column directly ...

public class TestHeader { public static void main(String[] args) { new TestHeader(); } public TestHeader() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } TableColumnModel model = new DefaultTableColumnModel(); final TableColumn column = new TableColumn(0, 250); column.setHeaderValue("Test"); model.addColumn(column); JTableHeader header = new JTableHeader(); header.setColumnModel(model); final JTextArea textArea = new JTextArea(); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setColumnHeaderView(header); textArea.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { column.setWidth(textArea.getWidth()); } }); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(scrollPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } }
UPDATED

public class TestHeader { public static void main(String[] args) { new TestHeader(); } public TestHeader() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { } catch (InstantiationException ex) { } catch (IllegalAccessException ex) { } catch (UnsupportedLookAndFeelException ex) { } TableColumnModel model = new DefaultTableColumnModel(); final TableColumn column = new TableColumn(0, 250); column.setHeaderValue("I don't see the problem"); model.addColumn(column); final JTableHeader header = new JTableHeader(); header.setColumnModel(model); DefaultTableModel tm = new DefaultTableModel(new Object[]{"A", "B", "C"}, 0); tm.addRow(new Object[]{"1", "2", "3", "4"}); tm.addRow(new Object[]{"5", "6", "7", "8"}); tm.addRow(new Object[]{"9", "10", "11", "12"}); tm.addRow(new Object[]{"13", "14", "15", "16"}); final JTable table = new JTable(tm); final JScrollPane scrollPane = new JScrollPane(table); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { scrollPane.setColumnHeaderView(header); } }); table.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { column.setWidth(table.getWidth()); } }); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(scrollPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } }
source share