void () { myAdjusting = true; myPreviewPanel.setLayout(new CardLayout()); myPreviewPanel.add(myEditorPreview.getPanel(), EDITOR); myPreviewPanel.add(myIdePreview, FRAME); UIUtil.removeScrollBorder(myPreviewPanel); myPreviewPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.ALL)); DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.add(createToggleAction(EDITOR, IdeBundle.message("toggle.editor.and.tools"))); actionGroup.add(createToggleAction(FRAME, IdeBundle.message("toggle.empty.frame"))); myToolbar = ActionManager.getInstance().createActionToolbar(getTitle(), actionGroup, true); JComponent toolbarComponent = myToolbar.getComponent(); toolbarComponent.setBorder(JBUI.Borders.empty()); myTargetPanel.add(toolbarComponent); initFlipPanel(myFlipPanel, myFlipHorCb, myFlipVerCb); initAnchorPanel(myAnchorPanel, myAnchorGroup); initFillPanel(myFillPanel, myFillGroup, getDisposable()); ((CardLayout)myPreviewPanel.getLayout()).show(myPreviewPanel, EDITOR); myPathField.getComboBox().setEditable(true); FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, true, false) .withFileFilter(file -> ImageFileTypeManager.getInstance().isImage(file)); myPathField.addBrowseFolderListener(null, null, null, descriptor, TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT); JTextComponent textComponent = getComboEditor(); textComponent.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { if (myAdjusting) return; imagePathChanged(); } }); for (Enumeration<AbstractButton> e = getFillRbGroup().getElements(); e.hasMoreElements();) { AbstractButton button = e.nextElement(); button.setActionCommand(button.getText()); button.addItemListener(this::fillOrAnchorChanged); } for (Enumeration<AbstractButton> e = getAnchorRbGroup().getElements(); e.hasMoreElements();) { AbstractButton button = e.nextElement(); button.setActionCommand(button.getText()); button.addItemListener(this::fillOrAnchorChanged); } myFlipHorCb.addItemListener(this::fillOrAnchorChanged); myFlipVerCb.addItemListener(this::fillOrAnchorChanged); ChangeListener opacitySync = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (myAdjusting) return; myAdjusting = true; boolean b = e.getSource() == myOpacitySpinner; if (b) { int value = (Integer)myOpacitySpinner.getValue(); myOpacitySpinner.setValue(MathUtil.clamp(value, 0, 100)); myOpacitySlider.setValue(value); } else { myOpacitySpinner.setValue(myOpacitySlider.getValue()); } myAdjusting = false; opacityChanged(); } }; myOpacitySpinner.addChangeListener(opacitySync); myOpacitySlider.addChangeListener(opacitySync); myOpacitySlider.setValue(15); myOpacitySpinner.setValue(15); boolean perProject = !Objects.equals(getBackgroundSpec(myProject, getSystemProp(true)), getBackgroundSpec(null, getSystemProp(true))); myThisProjectOnlyCb.setSelected(perProject); myAdjusting = false; }