@Override
	public void stateChanged() {
		setOkEnabled(false);
		changing = true;
		if (!isVisible()) {
			Program program = model.getProgram();
			newStartField.setProgram(program);
			newEndField.setProgram(program);
		}
		Address newStart = model.getNewStartAddress();
		if (newStart != null) {
			if (!newStart.equals(newStartField.getAddress())) {
				newStartField.setAddress(newStart);
			}
		}
		Address newEnd = model.getNewEndAddress();
		if (newEnd != null) {
			if (!newEnd.equals(newEndField.getAddress())) {
				newEndField.setAddress(newEnd);
			}
		}
		changing = false;
		String message = model.getMessage();
		setStatusText(message);

		if (!isVisible()) {
			blockNameLabel.setText(model.getName());
			origStartLabel.setText(model.getStartAddress().toString());
			origEndLabel.setText(model.getEndAddress().toString());
			lengthLabel.setText(model.getLengthString());
			tool.showDialog(this);
		}
		else if (message.length() == 0) {
			setOkEnabled(true);
		}
	}
Dialog that uses a model to validate the fields for moving a block of memory.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MoveBlockDialog.java