code: private void showPopup(int index) {
  		Object headerValue = columnModel.getColumn(index).getHeaderValue();
  		int columnCount = columnModel.getColumnCount();
  		JPopupMenu popup = new SelectPopupMenu();
  
  		// Create a menu item for all columns managed by the table column
  		// manager, checking to see if the column is shown or hidden.
  
  		for (TableColumn tableColumn : allColumns) {
  			Object value = tableColumn.getHeaderValue();
  			JCheckBoxMenuItem item = new JCheckBoxMenuItem(value.toString());
  			item.addActionListener(this);
  
  			try {
  				columnModel.getColumnIndex(value);
  				item.setSelected(true);
  
  				if (columnCount == 1) {
  					item.setEnabled(false);
  				}
  			} catch (IllegalArgumentException e) {
  				item.setSelected(false);
  			}
  
  			popup.add(item);
  
  			if (value == headerValue) {
  				popup.setSelected(item);
  			}
  		}
  
  		// Display the popup below the TableHeader
  
  		JTableHeader header = table.getTableHeader();
  		Rectangle r = header.getHeaderRect(index);
  		popup.show(header, r.x, r.height);
  	}
docs: /*
  Show a popup containing items for all the columns found in the table
  column manager. The popup will be displayed below the table header
  columns that was clicked.
  
  @param index index of the table header column that was clicked