@Test
public void testSetLastColumnMenuItemToUnselected() {

    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        return;
    }
    final JXTable table = new JXTable(10, 1);
    table.setColumnControlVisible(true);
    wrapWithScrollingInFrame(table, "");
    ColumnControlButton columnControl = (ColumnControlButton) table.getColumnControl();
    Component[] items = ((DefaultColumnControlPopup) columnControl.getColumnControlPopup()).getPopupMenu().getComponents();
    ((JMenuItem) items[0]).setSelected(false);
    assertEquals(1, table.getColumnCount());
}