/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.ide.ui; import com.intellij.ide.IdeBundle; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.options.SearchableConfigurable; import com.intellij.openapi.ui.ComboBox; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.ui.ListCellRendererWrapper; import com.intellij.ui.components.JBCheckBox; import com.intellij.util.ui.UIUtil; import consulo.annotations.RequiredDispatchThread; import consulo.ide.ui.laf.LafWithColorScheme; import consulo.util.ui.AATextInfo; import consulo.util.ui.AntialiasingUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Dictionary; import java.util.Hashtable; /** * @author Eugene Belyaev */ public class AppearanceConfigurable implements SearchableConfigurable { private MyComponent myComponent; @Override public String getDisplayName() { return IdeBundle.message("title.appearance"); } public AppearanceConfigurable() { myComponent = new MyComponent(); } private void initComponent() { if (myComponent == null) { myComponent = new MyComponent(); } } @RequiredDispatchThread @Override public JComponent createComponent() { UISettings settings = UISettings.getInstance(); initComponent(); DefaultComboBoxModel aModel = new DefaultComboBoxModel(UIUtil.getValidFontNames(false)); myComponent.myFontCombo.setModel(aModel); myComponent.myFontSizeCombo.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes())); myComponent.myPresentationModeFontSize.setModel(new DefaultComboBoxModel(UIUtil.getStandardFontSizes())); myComponent.myFontSizeCombo.setEditable(true); myComponent.myPresentationModeFontSize.setEditable(true); myComponent.myLafComboBox.setModel(new DefaultComboBoxModel(LafManager.getInstance().getInstalledLookAndFeels())); myComponent.myLafComboBox.setRenderer(new LafComboBoxRenderer()); myComponent.myAntialiasingInIDE.setModel(new DefaultComboBoxModel(AntialiasingType.values())); myComponent.myAntialiasingInEditor.setModel(new DefaultComboBoxModel(AntialiasingType.values())); myComponent.myAntialiasingInIDE.setSelectedItem(settings.IDE_AA_TYPE); myComponent.myAntialiasingInEditor.setSelectedItem(settings.EDITOR_AA_TYPE); myComponent.myAntialiasingInIDE.setRenderer(new AAListCellRenderer(false)); myComponent.myAntialiasingInEditor.setRenderer(new AAListCellRenderer(true)); Dictionary<Integer, JLabel> delayDictionary = new Hashtable<Integer, JLabel>(); delayDictionary.put(new Integer(0), new JLabel("0")); delayDictionary.put(new Integer(1200), new JLabel("1200")); //delayDictionary.put(new Integer(2400), new JLabel("2400")); myComponent.myInitialTooltipDelaySlider.setLabelTable(delayDictionary); UIUtil.setSliderIsFilled(myComponent.myInitialTooltipDelaySlider, Boolean.TRUE); myComponent.myInitialTooltipDelaySlider.setMinimum(0); myComponent.myInitialTooltipDelaySlider.setMaximum(1200); myComponent.myInitialTooltipDelaySlider.setPaintLabels(true); myComponent.myInitialTooltipDelaySlider.setPaintTicks(true); myComponent.myInitialTooltipDelaySlider.setPaintTrack(true); myComponent.myInitialTooltipDelaySlider.setMajorTickSpacing(1200); myComponent.myInitialTooltipDelaySlider.setMinorTickSpacing(100); myComponent.myEnableAlphaModeCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean state = myComponent.myEnableAlphaModeCheckBox.isSelected(); myComponent.myAlphaModeDelayTextField.setEnabled(state); myComponent.myAlphaModeRatioSlider.setEnabled(state); } }); myComponent.myAlphaModeRatioSlider.setSize(100, 50); @SuppressWarnings({"UseOfObsoleteCollectionType"}) Dictionary<Integer, JLabel> dictionary = new Hashtable<Integer, JLabel>(); dictionary.put(new Integer(0), new JLabel("0%")); dictionary.put(new Integer(50), new JLabel("50%")); dictionary.put(new Integer(100), new JLabel("100%")); myComponent.myAlphaModeRatioSlider.setLabelTable(dictionary); UIUtil.setSliderIsFilled(myComponent.myAlphaModeRatioSlider, Boolean.TRUE); myComponent.myAlphaModeRatioSlider.setPaintLabels(true); myComponent.myAlphaModeRatioSlider.setPaintTicks(true); myComponent.myAlphaModeRatioSlider.setPaintTrack(true); myComponent.myAlphaModeRatioSlider.setMajorTickSpacing(50); myComponent.myAlphaModeRatioSlider.setMinorTickSpacing(10); myComponent.myAlphaModeRatioSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { myComponent.myAlphaModeRatioSlider.setToolTipText(myComponent.myAlphaModeRatioSlider.getValue() + "%"); } }); myComponent.myTransparencyPanel.setVisible(WindowManagerEx.getInstanceEx().isAlphaModeSupported()); return myComponent.myPanel; } @RequiredDispatchThread @Override public void apply() { initComponent(); UISettings settings = UISettings.getInstance(); int _fontSize = getIntValue(myComponent.myFontSizeCombo, settings.FONT_SIZE); int _presentationFontSize = getIntValue(myComponent.myPresentationModeFontSize, settings.PRESENTATION_MODE_FONT_SIZE); boolean shouldUpdateUI = false; String _fontFace = (String)myComponent.myFontCombo.getSelectedItem(); LafManager lafManager = LafManager.getInstance(); if (_fontSize != settings.FONT_SIZE || !settings.FONT_FACE.equals(_fontFace)) { settings.FONT_SIZE = _fontSize; settings.FONT_FACE = _fontFace; shouldUpdateUI = true; } if (_presentationFontSize != settings.PRESENTATION_MODE_FONT_SIZE) { settings.PRESENTATION_MODE_FONT_SIZE = _presentationFontSize; shouldUpdateUI = true; } if (myComponent.myAntialiasingInIDE.getSelectedItem() != settings.IDE_AA_TYPE) { settings.IDE_AA_TYPE = (AntialiasingType)myComponent.myAntialiasingInIDE.getSelectedItem(); for (Window w : Window.getWindows()) { for (JComponent c : UIUtil.uiTraverser(w).filter(JComponent.class)) { AntialiasingUtil.setup(c::putClientProperty, AntialiasingType.getAAHintForSwingComponent()); } } shouldUpdateUI = true; } if (myComponent.myAntialiasingInEditor.getSelectedItem() != settings.EDITOR_AA_TYPE) { settings.EDITOR_AA_TYPE = (AntialiasingType)myComponent.myAntialiasingInEditor.getSelectedItem(); shouldUpdateUI = true; } settings.ANIMATE_WINDOWS = myComponent.myAnimateWindowsCheckBox.isSelected(); boolean update = settings.SHOW_TOOL_WINDOW_NUMBERS != myComponent.myWindowShortcutsCheckBox.isSelected(); settings.SHOW_TOOL_WINDOW_NUMBERS = myComponent.myWindowShortcutsCheckBox.isSelected(); update |= settings.HIDE_TOOL_STRIPES != !myComponent.myShowToolStripesCheckBox.isSelected(); settings.HIDE_TOOL_STRIPES = !myComponent.myShowToolStripesCheckBox.isSelected(); update |= settings.SHOW_ICONS_IN_MENUS != myComponent.myCbDisplayIconsInMenu.isSelected(); settings.SHOW_ICONS_IN_MENUS = myComponent.myCbDisplayIconsInMenu.isSelected(); update |= settings.SHOW_MEMORY_INDICATOR != myComponent.myShowMemoryIndicatorCheckBox.isSelected(); settings.SHOW_MEMORY_INDICATOR = myComponent.myShowMemoryIndicatorCheckBox.isSelected(); update |= settings.ALLOW_MERGE_BUTTONS != myComponent.myAllowMergeButtons.isSelected(); settings.ALLOW_MERGE_BUTTONS = myComponent.myAllowMergeButtons.isSelected(); update |= settings.CYCLE_SCROLLING != myComponent.myCycleScrollingCheckBox.isSelected(); settings.CYCLE_SCROLLING = myComponent.myCycleScrollingCheckBox.isSelected(); if (settings.OVERRIDE_NONIDEA_LAF_FONTS != myComponent.myOverrideLAFFonts.isSelected()) { shouldUpdateUI = true; } settings.OVERRIDE_NONIDEA_LAF_FONTS = myComponent.myOverrideLAFFonts.isSelected(); settings.MOVE_MOUSE_ON_DEFAULT_BUTTON = myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected(); settings.HIDE_NAVIGATION_ON_FOCUS_LOSS = myComponent.myHideNavigationPopupsCheckBox.isSelected(); settings.DND_WITH_PRESSED_ALT_ONLY = myComponent.myAltDNDCheckBox.isSelected(); update |= settings.DISABLE_MNEMONICS != myComponent.myDisableMnemonics.isSelected(); settings.DISABLE_MNEMONICS = myComponent.myDisableMnemonics.isSelected(); update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected(); settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected(); update |= settings.WIDESCREEN_SUPPORT != myComponent.myWidescreenLayoutCheckBox.isSelected(); settings.WIDESCREEN_SUPPORT = myComponent.myWidescreenLayoutCheckBox.isSelected(); update |= settings.LEFT_HORIZONTAL_SPLIT != myComponent.myLeftLayoutCheckBox.isSelected(); settings.LEFT_HORIZONTAL_SPLIT = myComponent.myLeftLayoutCheckBox.isSelected(); update |= settings.RIGHT_HORIZONTAL_SPLIT != myComponent.myRightLayoutCheckBox.isSelected(); settings.RIGHT_HORIZONTAL_SPLIT = myComponent.myRightLayoutCheckBox.isSelected(); update |= settings.SHOW_EDITOR_TOOLTIP != myComponent.myEditorTooltipCheckBox.isSelected(); settings.SHOW_EDITOR_TOOLTIP = myComponent.myEditorTooltipCheckBox.isSelected(); update |= settings.DISABLE_MNEMONICS_IN_CONTROLS != myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); settings.DISABLE_MNEMONICS_IN_CONTROLS = myComponent.myDisableMnemonicInControlsCheckBox.isSelected(); update |= settings.SHOW_ICONS_IN_QUICK_NAVIGATION != myComponent.myHideIconsInQuickNavigation.isSelected(); settings.SHOW_ICONS_IN_QUICK_NAVIGATION = myComponent.myHideIconsInQuickNavigation.isSelected(); if (!Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), lafManager.getCurrentLookAndFeel())) { final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem(); if (lafManager.checkLookAndFeel(lafInfo)) { update = shouldUpdateUI = true; lafManager.setCurrentLookAndFeel(lafInfo); } if (lafInfo instanceof LafWithColorScheme) { EditorColorsManager editorColorsManager = EditorColorsManager.getInstance(); EditorColorsScheme editorColorsScheme = editorColorsManager.getScheme(((LafWithColorScheme)lafInfo).getColorSchemeName()); if (editorColorsScheme != null) { editorColorsManager.setGlobalScheme(editorColorsScheme); } } } if (shouldUpdateUI) { lafManager.updateUI(); } if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) { int delay = -1; try { delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText()); } catch (NumberFormatException ignored) { } float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f; if (myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE || delay != -1 && delay != settings.ALPHA_MODE_DELAY || ratio != settings.ALPHA_MODE_RATIO) { update = true; settings.ENABLE_ALPHA_MODE = myComponent.myEnableAlphaModeCheckBox.isSelected(); settings.ALPHA_MODE_DELAY = delay; settings.ALPHA_MODE_RATIO = ratio; } } int tooltipDelay = Math.min(myComponent.myInitialTooltipDelaySlider.getValue(), 5000); if (tooltipDelay != Registry.intValue("ide.tooltip.initialDelay")) { update = true; Registry.get("ide.tooltip.initialDelay").setValue(tooltipDelay); } if (update) { settings.fireUISettingsChanged(); } myComponent.updateCombo(); EditorUtil.reinitSettings(); } private static int getIntValue(JComboBox combo, int defaultValue) { String temp = (String)combo.getEditor().getItem(); int value = -1; if (temp != null && temp.trim().length() > 0) { try { value = Integer.parseInt(temp); } catch (NumberFormatException ignore) { } if (value <= 0) { value = defaultValue; } } else { value = defaultValue; } return value; } @RequiredDispatchThread @Override public void reset() { initComponent(); UISettings settings = UISettings.getInstance(); myComponent.myFontCombo.setSelectedItem(settings.FONT_FACE); myComponent.myAntialiasingInIDE.setSelectedItem(settings.IDE_AA_TYPE); myComponent.myAntialiasingInEditor.setSelectedItem(settings.EDITOR_AA_TYPE); myComponent.myFontSizeCombo.setSelectedItem(Integer.toString(settings.FONT_SIZE)); myComponent.myPresentationModeFontSize.setSelectedItem(Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE)); myComponent.myAnimateWindowsCheckBox.setSelected(settings.ANIMATE_WINDOWS); myComponent.myWindowShortcutsCheckBox.setSelected(settings.SHOW_TOOL_WINDOW_NUMBERS); myComponent.myShowToolStripesCheckBox.setSelected(!settings.HIDE_TOOL_STRIPES); myComponent.myCbDisplayIconsInMenu.setSelected(settings.SHOW_ICONS_IN_MENUS); myComponent.myShowMemoryIndicatorCheckBox.setSelected(settings.SHOW_MEMORY_INDICATOR); myComponent.myAllowMergeButtons.setSelected(settings.ALLOW_MERGE_BUTTONS); myComponent.myCycleScrollingCheckBox.setSelected(settings.CYCLE_SCROLLING); myComponent.myHideIconsInQuickNavigation.setSelected(settings.SHOW_ICONS_IN_QUICK_NAVIGATION); myComponent.myMoveMouseOnDefaultButtonCheckBox.setSelected(settings.MOVE_MOUSE_ON_DEFAULT_BUTTON); myComponent.myHideNavigationPopupsCheckBox.setSelected(settings.HIDE_NAVIGATION_ON_FOCUS_LOSS); myComponent.myAltDNDCheckBox.setSelected(settings.DND_WITH_PRESSED_ALT_ONLY); myComponent.myLafComboBox.setSelectedItem(LafManager.getInstance().getCurrentLookAndFeel()); myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS); myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS); myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS); myComponent.myWidescreenLayoutCheckBox.setSelected(settings.WIDESCREEN_SUPPORT); myComponent.myLeftLayoutCheckBox.setSelected(settings.LEFT_HORIZONTAL_SPLIT); myComponent.myRightLayoutCheckBox.setSelected(settings.RIGHT_HORIZONTAL_SPLIT); myComponent.myEditorTooltipCheckBox.setSelected(settings.SHOW_EDITOR_TOOLTIP); myComponent.myDisableMnemonicInControlsCheckBox.setSelected(settings.DISABLE_MNEMONICS_IN_CONTROLS); boolean alphaModeEnabled = WindowManagerEx.getInstanceEx().isAlphaModeSupported(); if (alphaModeEnabled) { myComponent.myEnableAlphaModeCheckBox.setSelected(settings.ENABLE_ALPHA_MODE); } else { myComponent.myEnableAlphaModeCheckBox.setSelected(false); } myComponent.myEnableAlphaModeCheckBox.setEnabled(alphaModeEnabled); myComponent.myAlphaModeDelayTextField.setText(Integer.toString(settings.ALPHA_MODE_DELAY)); myComponent.myAlphaModeDelayTextField.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE); int ratio = (int)(settings.ALPHA_MODE_RATIO * 100f); myComponent.myAlphaModeRatioSlider.setValue(ratio); myComponent.myAlphaModeRatioSlider.setToolTipText(ratio + "%"); myComponent.myAlphaModeRatioSlider.setEnabled(alphaModeEnabled && settings.ENABLE_ALPHA_MODE); myComponent.myInitialTooltipDelaySlider.setValue(Registry.intValue("ide.tooltip.initialDelay")); myComponent.updateCombo(); } @RequiredDispatchThread @Override public boolean isModified() { initComponent(); UISettings settings = UISettings.getInstance(); boolean isModified = false; isModified |= !Comparing.equal(myComponent.myFontCombo.getSelectedItem(), settings.FONT_FACE); isModified |= !Comparing.equal(myComponent.myFontSizeCombo.getEditor().getItem(), Integer.toString(settings.FONT_SIZE)); isModified |= myComponent.myAntialiasingInIDE.getSelectedItem() != settings.IDE_AA_TYPE; isModified |= myComponent.myAntialiasingInEditor.getSelectedItem() != settings.EDITOR_AA_TYPE; isModified |= myComponent.myAnimateWindowsCheckBox.isSelected() != settings.ANIMATE_WINDOWS; isModified |= myComponent.myWindowShortcutsCheckBox.isSelected() != settings.SHOW_TOOL_WINDOW_NUMBERS; isModified |= myComponent.myShowToolStripesCheckBox.isSelected() == settings.HIDE_TOOL_STRIPES; isModified |= myComponent.myCbDisplayIconsInMenu.isSelected() != settings.SHOW_ICONS_IN_MENUS; isModified |= myComponent.myShowMemoryIndicatorCheckBox.isSelected() != settings.SHOW_MEMORY_INDICATOR; isModified |= myComponent.myAllowMergeButtons.isSelected() != settings.ALLOW_MERGE_BUTTONS; isModified |= myComponent.myCycleScrollingCheckBox.isSelected() != settings.CYCLE_SCROLLING; isModified |= myComponent.myOverrideLAFFonts.isSelected() != settings.OVERRIDE_NONIDEA_LAF_FONTS; isModified |= myComponent.myDisableMnemonics.isSelected() != settings.DISABLE_MNEMONICS; isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS; isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS; isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.WIDESCREEN_SUPPORT; isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.LEFT_HORIZONTAL_SPLIT; isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.RIGHT_HORIZONTAL_SPLIT; isModified |= myComponent.myEditorTooltipCheckBox.isSelected() != settings.SHOW_EDITOR_TOOLTIP; isModified |= myComponent.myHideIconsInQuickNavigation.isSelected() != settings.SHOW_ICONS_IN_QUICK_NAVIGATION; isModified |= !Comparing.equal(myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE)); isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.MOVE_MOUSE_ON_DEFAULT_BUTTON; isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.HIDE_NAVIGATION_ON_FOCUS_LOSS; isModified |= myComponent.myAltDNDCheckBox.isSelected() != settings.DND_WITH_PRESSED_ALT_ONLY; isModified |= !Comparing.equal(myComponent.myLafComboBox.getSelectedItem(), LafManager.getInstance().getCurrentLookAndFeel()); if (WindowManagerEx.getInstanceEx().isAlphaModeSupported()) { isModified |= myComponent.myEnableAlphaModeCheckBox.isSelected() != settings.ENABLE_ALPHA_MODE; int delay = -1; try { delay = Integer.parseInt(myComponent.myAlphaModeDelayTextField.getText()); } catch (NumberFormatException ignored) { } if (delay != -1) { isModified |= delay != settings.ALPHA_MODE_DELAY; } float ratio = myComponent.myAlphaModeRatioSlider.getValue() / 100f; isModified |= ratio != settings.ALPHA_MODE_RATIO; } int tooltipDelay = -1; tooltipDelay = myComponent.myInitialTooltipDelaySlider.getValue(); isModified |= tooltipDelay != Registry.intValue("ide.tooltip.initialDelay"); return isModified; } @RequiredDispatchThread @Override public void disposeUIResources() { myComponent = null; } @Override public String getHelpTopic() { return "preferences.lookFeel"; } private static class MyComponent { private JPanel myPanel; private JComboBox myFontCombo; private JComboBox myFontSizeCombo; private JCheckBox myAnimateWindowsCheckBox; private JCheckBox myWindowShortcutsCheckBox; private JCheckBox myShowToolStripesCheckBox; private JCheckBox myShowMemoryIndicatorCheckBox; private JComboBox myLafComboBox; private JCheckBox myCycleScrollingCheckBox; private JCheckBox myMoveMouseOnDefaultButtonCheckBox; private JCheckBox myEnableAlphaModeCheckBox; private JTextField myAlphaModeDelayTextField; private JSlider myAlphaModeRatioSlider; private JLabel myFontSizeLabel; private JLabel myFontNameLabel; private JPanel myTransparencyPanel; private JCheckBox myOverrideLAFFonts; private JCheckBox myHideIconsInQuickNavigation; private JCheckBox myCbDisplayIconsInMenu; private JCheckBox myDisableMnemonics; private JCheckBox myDisableMnemonicInControlsCheckBox; private JCheckBox myHideNavigationPopupsCheckBox; private JCheckBox myAltDNDCheckBox; private JCheckBox myAllowMergeButtons; private JBCheckBox myUseSmallLabelsOnTabs; private JBCheckBox myWidescreenLayoutCheckBox; private JCheckBox myLeftLayoutCheckBox; private JCheckBox myRightLayoutCheckBox; private JSlider myInitialTooltipDelaySlider; private ComboBox myPresentationModeFontSize; private JCheckBox myEditorTooltipCheckBox; private JComboBox myAntialiasingInIDE; private JComboBox myAntialiasingInEditor; public MyComponent() { myOverrideLAFFonts.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateCombo(); } }); } public void updateCombo() { boolean enableChooser = myOverrideLAFFonts.isSelected(); myFontCombo.setEnabled(enableChooser); myFontSizeCombo.setEnabled(enableChooser); myFontNameLabel.setEnabled(enableChooser); myFontSizeLabel.setEnabled(enableChooser); } private void createUIComponents() { myFontSizeCombo = new ComboBox(); myPresentationModeFontSize = new ComboBox(); } } @Override @NotNull public String getId() { //noinspection ConstantConditions return getHelpTopic(); } @Override @Nullable public Runnable enableSearch(String option) { return null; } private static class AAListCellRenderer extends ListCellRendererWrapper<AntialiasingType> { private static final AATextInfo SUBPIXEL_HINT = new AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, UIUtil.getLcdContrastValue()); private static final AATextInfo GREYSCALE_HINT = new AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_ON, UIUtil.getLcdContrastValue()); private final boolean useEditorAASettings; public AAListCellRenderer(boolean useEditorAASettings) { super(); this.useEditorAASettings = useEditorAASettings; } @Override public void customize(JList list, AntialiasingType value, int index, boolean selected, boolean hasFocus) { if (value == AntialiasingType.SUBPIXEL) { AntialiasingUtil.setup(this::setClientProperty, SUBPIXEL_HINT); } else if (value == AntialiasingType.GREYSCALE) { AntialiasingUtil.setup(this::setClientProperty, GREYSCALE_HINT); } else if (value == AntialiasingType.OFF) { AntialiasingUtil.setup(this::setClientProperty, null); } if (useEditorAASettings) { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); setFont(new Font(scheme.getEditorFontName(), Font.PLAIN, scheme.getEditorFontSize())); } setText(String.valueOf(value)); } } }