FileDocCategorySizeDatePackage
ColumnSelectableJTable.javaAPI DocExample1082Mon Jan 09 11:01:58 GMT 2006None

ColumnSelectableJTable

public class ColumnSelectableJTable extends JTable

Fields Summary
Constructors Summary
public ColumnSelectableJTable(Object[] items, Object[] headers)

        super (items, headers);
        setColumnSelectionAllowed (true);
        setRowSelectionAllowed (false);
        // set up action listener on table header
        final JTableHeader header = getTableHeader();
        header.addMouseListener (new MouseAdapter() {
                public void mouseReleased (MouseEvent e) {
                    /*
                    System.out.println ("mouseReleased: " + e);
                    System.out.println ("col = " +
                                        getColumnModel().getColumn(header.columnAtPoint (e.getPoint())).getIdentifier());
                    */
                    if (! e.isShiftDown())
                        clearSelection();
                    int pick = header.columnAtPoint(e.getPoint());
                    addColumnSelectionInterval (pick, pick);
                }
            });
        
    
Methods Summary