src/main/java/org/jwellman/swing/jtable/TableColumnManager.java
@Override
    public void actionPerformed(ActionEvent event) {

        String columnName = null;
        boolean isSelected = false;

        if (event.getSource() instanceof JMenuItem) {

            final JMenuItem item = (JMenuItem) event.getSource();
            columnName = item.getText();
            isSelected = item.isSelected();

        } else if (event.getSource() instanceof JCheckBox) {

            final JCheckBox box = (JCheckBox) event.getSource();
            columnName = box.getText();
            isSelected = box.isSelected();

        }
       
        if (isSelected) showColumn(columnName); else hideColumn(columnName);

    }
/**
     * A table column will either be added to the table or removed from the table
     * depending on the state of the menu item that was clicked.
     */
A table column will either be added to the table or removed from the table
depending on the state of the menu item that was clicked.
A table column will either be added to the table or removed from the table depending on the state of the menu item that was clicked .
@Override
    public void actionPerformed(ActionEvent event) {
        String columnName = null;
        boolean isSelected = false;
        if (event.getSource() instanceof JMenuItem) {
            final JMenuItem item = (JMenuItem) event.getSource();
            columnName = item.getText();
            isSelected = item.isSelected();
        } else if (event.getSource() instanceof JCheckBox) {
            final JCheckBox box = (JCheckBox) event.getSource();
            columnName = box.getText();
            isSelected = box.isSelected();
        }
        if (isSelected) showColumn(columnName); else hideColumn(columnName);
    }
@ Override public void actionPerformed ( ActionEvent event ) { String columnName = null ; boolean isSelected = false ; if ( event . getSource ( ) instanceof JMenuItem ) { final JMenuItem item = ( JMenuItem ) event . getSource ( ) ; columnName = item . getText ( ) ; isSelected = item . isSelected ( ) ; } else if ( event . getSource ( ) instanceof JCheckBox ) { final JCheckBox box = ( JCheckBox ) event . getSource ( ) ; columnName = box . getText ( ) ; isSelected = box . isSelected ( ) ; } if ( isSelected ) showColumn ( columnName ) ; else hideColumn ( columnName ) ; }
A table column will either be added to the table or removed from the table
 depending on the state of the menu item that was clicked.
A table column will either be added to the table or removed from the table depending on the state of the menu item that was clicked .