@Override
		public void mousePressed(MouseEvent e) {
			if (e.isConsumed()) {
				return;
			}
			if (!placementComponent.isWithinBitCell(e.getPoint())) {
				return;
			}
			if (e.getButton() == MouseEvent.BUTTON1) {
				e.consume();
				selectionActive = false;
				if (bitOffsetInput.isEnabled()) {
					bitSizeModel.setValue(1L); // must change size first
					startBit = setBitFieldOffset(e.getPoint());
					lastBit = startBit;
					selectionActive = startBit >= 0;
					if (selectionActive) {
						lastX = e.getPoint().x;
						setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
					}
				}
			}
		}
<code>BitFieldEditorPanel</code> provides the ability to add or modify bitfields
within non-packed structures.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java