This is the screenshot.
This is my code to build and set the header.
private void buildHeader() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.add(Box.createHorizontalStrut(10));
panel.add(new JLabel("Documents"));
panel.add(Box.createHorizontalGlue());
panel.add(new JButton("View"));
panel.add(new JButton("Print"));
panel.setBorder(BorderFactory.createLineBorder(new Color(210, 210, 210)));
panel.setBackground(new Color(245, 245, 245));
panel.setPreferredSize(new Dimension(panel.getPreferredSize().width, 51));
setColumnHeaderView(panel);
}
But, I am not able to make the header to take its whole space. It is leaving the space above vertical scroll bar.
So, How can I make this column header to take up its whole width.