JComponent () { myView.setBorder(BorderFactory.createEtchedBorder()); myView.setMinimumSize(new JBDimension(360, 200)); myView.setPreferredSize(new JBDimension(720, 400)); myView.addMouseListener(new MouseAdapter() { private JFileChooser myFileChooser; @Override public void mousePressed(MouseEvent event) { if (SwingUtilities.isLeftMouseButton(event)) { if (myFileChooser == null) { myFileChooser = new JFileChooser(); myFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); myFileChooser.setMultiSelectionEnabled(false); } File file = JFileChooser.APPROVE_OPTION != myFileChooser.showOpenDialog(myView) ? null : myFileChooser.getSelectedFile(); if (file != null) { try { myView.setImage(ImageIO.read(file)); } catch (Exception exception) { myView.setImage(null); } } } } }); ChangeListener listener = event -> { if (myView.myFilter instanceof MutableFilter) { updateFilter((MutableFilter)myView.myFilter); } }; myCombo.addItemListener(event -> { if (ItemEvent.SELECTED == event.getStateChange()) { Object object = event.getItem(); if (object instanceof FilterItem item) { if (item.myFilter instanceof MutableFilter) { showSlider(myFirstSlider, listener); showSlider(mySecondSlider, listener); updateFilter((MutableFilter)item.myFilter); } else { hideSlider(myFirstSlider, listener); hideSlider(mySecondSlider, listener); myView.setFilter(item.myFilter); } } } }); JPanel control = new JPanel(new VerticalLayout(10)); control.add(VerticalLayout.TOP, myCombo); control.add(VerticalLayout.TOP, myFirstSlider); control.add(VerticalLayout.TOP, mySecondSlider); JPanel panel = new JPanel(new BorderLayout(10, 10)); panel.add(BorderLayout.CENTER, myView); panel.add(BorderLayout.SOUTH, control); return panel; }