@Override
 public void propertyChange(PropertyChangeEvent event) {
   boolean internal = myInternal;
   myInternal = true;
   Object value = event.getNewValue();
   if (ShortcutFilteringPanel.this == event.getSource()) {
     if (value instanceof KeyboardShortcut) {
       KeyboardShortcut shortcut = (KeyboardShortcut) value;
       myMousePanel.setShortcut(null);
       myKeyboardPanel.setShortcut(shortcut);
       if (null != shortcut.getSecondKeyStroke()) {
         myKeyboardPanel.mySecondStrokeEnable.setSelected(true);
       }
     } else {
       MouseShortcut shortcut =
           value instanceof MouseShortcut ? (MouseShortcut) value : null;
       String text = shortcut == null ? null : KeymapUtil.getMouseShortcutText(shortcut);
       myMousePanel.setShortcut(shortcut);
       myKeyboardPanel.setShortcut(null);
       myKeyboardPanel.myFirstStroke.setText(text);
       myKeyboardPanel.mySecondStroke.setText(null);
       myKeyboardPanel.mySecondStroke.setEnabled(false);
     }
   } else if (value instanceof Shortcut) {
     setShortcut((Shortcut) value);
   } else if (!internal) {
     setShortcut(null);
   }
   myInternal = internal;
 }
  ShortcutFilteringPanel() {
    super(new VerticalLayout(JBUI.scale(2)));

    myKeyboardPanel.myFirstStroke.setColumns(13);
    myKeyboardPanel.myFirstStroke.putClientProperty("JTextField.variant", "search");
    myKeyboardPanel.mySecondStroke.setColumns(13);
    myKeyboardPanel.mySecondStroke.putClientProperty("JTextField.variant", "search");
    myKeyboardPanel.mySecondStroke.setVisible(false);
    myKeyboardPanel.mySecondStrokeEnable.setText(
        KeyMapBundle.message("filter.enable.second.stroke.checkbox"));
    myKeyboardPanel.mySecondStrokeEnable.addChangeListener(myChangeListener);
    myKeyboardPanel.add(VerticalLayout.TOP, myKeyboardPanel.myFirstStroke);
    myKeyboardPanel.add(VerticalLayout.TOP, myKeyboardPanel.mySecondStrokeEnable);
    myKeyboardPanel.add(VerticalLayout.TOP, myKeyboardPanel.mySecondStroke);
    myKeyboardPanel.addPropertyChangeListener("shortcut", myPropertyListener);
    myKeyboardPanel.setBorder(JBUI.Borders.empty(4));

    JLabel label = new JLabel(KeyMapBundle.message("filter.mouse.pad.label"));
    label.setOpaque(false);
    label.setIcon(AllIcons.General.MouseShortcut);
    label.setForeground(MouseShortcutPanel.FOREGROUND);
    label.setBorder(JBUI.Borders.empty(14, 4));
    myMousePanel.add(BorderLayout.CENTER, label);
    myMousePanel.addPropertyChangeListener("shortcut", myPropertyListener);
    myMousePanel.setBorder(JBUI.Borders.customLine(MouseShortcutPanel.BORDER, 1, 0, 0, 0));

    add(VerticalLayout.TOP, myKeyboardPanel);
    add(VerticalLayout.TOP, myMousePanel);
    addPropertyChangeListener("shortcut", myPropertyListener);
  }
 @Override
 public void stateChanged(ChangeEvent event) {
   boolean selected = myKeyboardPanel.mySecondStrokeEnable.isSelected();
   myKeyboardPanel.mySecondStroke.setVisible(selected);
   myMousePanel.setVisible(!selected);
   if (selected && myShortcut instanceof MouseShortcut) {
     setShortcut(null);
   }
 }