@Override
    public void mouseClicked(final MouseEvent event) {
      final int registerNumber = getRegisterNumber(event.getX(), event.getY());

      if (event.getButton() == MouseEvent.BUTTON1) {

        if (event.getClickCount() == 1) {
          if ((editedRegister != -1) && (registerNumber != editedRegister)) {
            leaveEditMode(false);
          }
        } else if (event.getClickCount() == 2) {
          // Switch to edit mode after a double click.
          if ((registerNumber != -1) && (editedRegister == -1)) {
            final RegisterInformationInternal register =
                registerModel.getRegisterInformation(registerNumber);

            if (register.getRegisterSize() == 0) {
              registerModel.setValue(
                  register.getRegisterName(), register.getValue().xor(BigInteger.ONE));
            } else {
              enterEditMode(highlightedRegister);
            }
          }
        }
      } else if (event.getButton() == MouseEvent.BUTTON3) {
        if (event.getClickCount() == 1) {
          if ((editedRegister != -1) && (registerNumber != editedRegister)) {
            leaveEditMode(false);
          }

          final JPopupMenu menu = menuProvider.getRegisterMenu(registerNumber);

          if (menu != null) {
            menu.show(JRegisterView.this, event.getX(), event.getY());
          }
        }
      }
    }
Tests whether a character is a valid hex input value.

@param c The character to test.
@return True, if the character is a valid hex input value. False, otherwise.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/JRegisterView/JRegisterView.java