private void createMouseEvents() {
		// A mouse listener is needed to keep track of mouse clicks on a column.  This is
		// the only way for us to know which column to apply an event to when using the 
		// context pop-up.
		this.getTableHeader().addMouseListener(new MouseAdapter() {

			@Override
			public void mousePressed(MouseEvent arg0) {
				selectedColumn = InstructionTable.this.columnAtPoint(arg0.getPoint());
			}
		});

		// Set up a mouse release listener as the trigger for toggling mask state
		// on table cells.  
		addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent evt) {
				if (SwingUtilities.isLeftMouseButton(evt)) {

					// To get the proper cell that the mouse was released on we have to 
					// use rowAtPoint(). Using getRowSelection() would seem to be a better option, 
					// but will not be accurate in the case of a drag-and-release, since it 
					// will produce an array of options along the entire drag path, and we won't 
					// know whether to grab the first item in the array or the last (depends on 
					// which direction the user drags - up or down).
					int rowSelection = InstructionTable.this.rowAtPoint(evt.getPoint());
					int columnSelection = InstructionTable.this.columnAtPoint(evt.getPoint());

					// If the row or col are -1, then the user has released the mouse outside of
					// the table; don't process this.
					if (rowSelection == -1 || columnSelection == -1) {
						return;
					}

					InstructionTableDataObject dataObject =
						getCellData(rowSelection, columnSelection);
					if (dataObject != null) {
						dataObject.toggleMaskState();

						// Clear out any messages.
						if (dialog.getMessagePanel() != null) {
							dialog.getMessagePanel().clear();
						}
					}
				}
			}
		});
	}
Adds mouse event listeners for clicking on the table header and internal
cells.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InstructionTable.java