List of usage examples for javax.swing.table JTableHeader setLayout
public void setLayout(LayoutManager mgr)
From source file:org.apache.cayenne.modeler.editor.AbstractCallbackMethodsTab.java
private void addButtonAtHeader(JTable table, JButton button, ActionListener buttonListener, ImageIcon buttonIcon) {/*from w w w .j a v a2s . c om*/ PanelBuilder builder = new PanelBuilder(new FormLayout("left:10dlu, 2dlu", "center:10dlu")); CellConstraints cc = new CellConstraints(); button.setIcon(buttonIcon); button.setOpaque(false); button.setBorderPainted(false); button.setContentAreaFilled(false); button.addActionListener(buttonListener); builder.add(button, cc.xy(1, 1)); JPanel buttonPanel = builder.getPanel(); buttonPanel.setOpaque(false); JTableHeader header = table.getTableHeader(); header.setLayout(new BorderLayout()); header.setReorderingAllowed(false); header.setPreferredSize(new Dimension(150, 20)); header.add(buttonPanel, BorderLayout.EAST); }