JComponent () { final MyListModel model = new MyListModel(); final JButton button = new JButton(RegExpBundle.message("edit.metadata.button")); button.addActionListener(__ -> performEditMetaData(button)); final JList<InspectionPattern> list = new JBList<>(model); list.setVisibleRowCount(3); list.setCellRenderer(new RegExpInspectionConfigurationCellRenderer()); final JPanel listPanel = ToolbarDecorator.createDecorator(list) .setAddAction(b -> performAdd(list, b)) .setAddActionName(RegExpBundle.message("action.add.pattern.text")) .setAddIcon(LayeredIcon.ADD_WITH_DROPDOWN) .setRemoveAction(b -> performRemove(list)) .setRemoveActionUpdater(e -> list.getSelectedValuesList().size() < list.getModel().getSize()) .setEditAction(b -> performEdit(list)) .setMoveUpAction(b -> performMove(list, true)) .setMoveDownActionUpdater(e -> list.getSelectedValuesList().size() == 1) .setMoveDownAction(b -> performMove(list, false)) .setMoveDownActionUpdater(e -> list.getSelectedValuesList().size() == 1) .createPanel(); new DoubleClickListener() { @Override protected boolean onDoubleClick(@NotNull MouseEvent e) { performEdit(list); return true; } }.installOn(list); final JPanel panel = new FormBuilder() .addComponent(button) .addVerticalGap(UIUtil.DEFAULT_VGAP) .addLabeledComponentFillVertically(RegExpBundle.message("label.regexp.patterns"), listPanel) .getPanel(); panel.setBorder(JBUI.Borders.emptyTop(10)); return panel; }