diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.java new file mode 100644 index 00000000..cb6ed331 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.java @@ -0,0 +1,781 @@ +/* + * Copyright 2020 FormDev Software GmbH + * + * 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 + * + * https://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.formdev.flatlaf.testing; + +import java.awt.Component; +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.image.FilteredImageSource; +import java.awt.image.ImageProducer; +import java.awt.image.RGBImageFilter; +import java.beans.*; +import javax.swing.*; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatDisabledIconsTest + extends FlatTestPanel +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatTestFrame frame = FlatTestFrame.create( args, "FlatDisabledIconsTest" ); + frame.showFrame( FlatDisabledIconsTest::new ); + } ); + } + + FlatDisabledIconsTest() { + initComponents(); + + RGBImageFilter plasticLafFilter = new PlasticRGBGrayFilter(); + RGBImageFilter intellijTextFilter = new IntelliJGrayFilter( 20, 0, 100 ); + RGBImageFilter netbeansFilter = new NetBeansDisabledButtonFilter(); + + for( Component c : enabledToolBar.getComponents() ) { + AbstractButton b = (AbstractButton) c; + Icon icon = b.getIcon(); + + JToggleButton cb = new JToggleButton( icon ); + cb.setEnabled( false ); + currentLafToolBar.add( cb ); + basicLafToolBar.add( new FilterButton( null, icon ) ); + metalLafToolBar.add( new FilterButton( null, icon ) ); + plasticToolBar.add( new FilterButton( plasticLafFilter, icon ) ); + intellijTextToolBar.add( new FilterButton( intellijTextFilter, icon ) ); + intellijLightToolBar.add( new FilterButton( null, icon ) ); + intellijDarkToolBar.add( new FilterButton( null, icon ) ); + netbeansToolBar.add( new FilterButton( netbeansFilter, icon ) ); + } + + Icon zipIcon = zipButton.getIcon(); + JToggleButton cb = new JToggleButton( zipIcon ); + cb.setEnabled( false ); + zipToolBar.add( cb ); + zipToolBar.add( new FilterButton( null, zipIcon ) ); + zipToolBar.add( new FilterButton( null, zipIcon ) ); + zipToolBar.add( new FilterButton( plasticLafFilter, zipIcon ) ); + zipToolBar.add( new FilterButton( intellijTextFilter, zipIcon ) ); + zipToolBar.add( new FilterButton( null, zipIcon ) ); + zipToolBar.add( new FilterButton( null, zipIcon ) ); + zipToolBar.add( new FilterButton( netbeansFilter, zipIcon ) ); + + basicLafReset(); + metalLafReset(); + + intelliJTextFilterController.defaultBrightness = 20; + intelliJTextFilterController.defaultContrast = 0; + intelliJTextFilterController.reset(); + + // values from intellijlaf.properties + intelliJLightFilterController.defaultBrightness = 33; + intelliJLightFilterController.defaultContrast = -35; + intelliJLightFilterController.reset(); + + // values from darcula.properties + intelliJDarkFilterController.defaultBrightness = -70; + intelliJDarkFilterController.defaultContrast = -70; + intelliJDarkFilterController.reset(); + } + + private void selectedChanged() { + boolean armed = selectedCheckBox.isSelected(); + for( Component c : getComponents() ) { + if( c instanceof JToolBar ) { + for( Component c2 : ((JToolBar)c).getComponents() ) { + if( c2 instanceof JToggleButton ) + ((JToggleButton)c2).getModel().setSelected( armed ); + } + } + } + } + + private void basicLafChanged() { + boolean brighter = basicLafBrighterCheckBox.isSelected(); + int percent = basicLafPercentSlider.getValue(); + + basicLafPercentValue.setText( String.valueOf( percent ) ); + + RGBImageFilter filter = new GrayFilter( brighter, percent ); + updateFilter( basicLafToolBar, 2, filter ); + } + + private void basicLafReset() { + basicLafBrighterCheckBox.setSelected( true ); + basicLafPercentSlider.setValue( 50 ); + basicLafChanged(); + } + + private void metalLafChanged() { + int min = metalLafMinSlider.getValue(); + int max = metalLafMaxSlider.getValue(); + + metalLafMinValue.setText( String.valueOf( min ) ); + metalLafMaxValue.setText( String.valueOf( max ) ); + + RGBImageFilter filter = new MetalDisabledButtonImageFilter( min, max ); + updateFilter( metalLafToolBar, 3, filter ); + } + + private void metalLafReset() { + metalLafMinSlider.setValue( 180 ); + metalLafMaxSlider.setValue( 215 ); + metalLafChanged(); + } + + private void intelliJTextFilterChanged(PropertyChangeEvent e) { + updateFilter( intellijTextToolBar, 5, (RGBImageFilter) e.getNewValue() ); + } + + private void intelliJLightFilterChanged(PropertyChangeEvent e) { + updateFilter( intellijLightToolBar, 6, (RGBImageFilter) e.getNewValue() ); + } + + private void intelliJDarkFilterChanged(PropertyChangeEvent e) { + updateFilter( intellijDarkToolBar, 7, (RGBImageFilter) e.getNewValue() ); + } + + private void updateFilter( JToolBar toolBar, int zipIndex, RGBImageFilter filter ) { + for( Component c : toolBar.getComponents() ) + ((FilterButton)c).setFilter( filter ); + + ((FilterButton)zipToolBar.getComponent( zipIndex )).setFilter( filter ); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel enabledLabel = new JLabel(); + enabledToolBar = new JToolBar(); + JToggleButton button1 = new JToggleButton(); + JToggleButton button2 = new JToggleButton(); + JToggleButton button3 = new JToggleButton(); + JToggleButton button4 = new JToggleButton(); + JToggleButton button5 = new JToggleButton(); + JToggleButton button6 = new JToggleButton(); + JToggleButton button7 = new JToggleButton(); + JToggleButton button8 = new JToggleButton(); + JToggleButton button9 = new JToggleButton(); + JToggleButton button10 = new JToggleButton(); + JToggleButton button11 = new JToggleButton(); + JToggleButton button12 = new JToggleButton(); + JToggleButton button13 = new JToggleButton(); + JToggleButton button14 = new JToggleButton(); + JToggleButton button15 = new JToggleButton(); + JToggleButton button16 = new JToggleButton(); + JToggleButton button17 = new JToggleButton(); + JToggleButton button18 = new JToggleButton(); + JLabel currentLabel = new JLabel(); + currentLafToolBar = new JToolBar(); + JLabel basicLafLabel = new JLabel(); + basicLafToolBar = new JToolBar(); + JPanel panel2 = new JPanel(); + basicLafBrighterCheckBox = new JCheckBox(); + JLabel basicLafPercentLabel = new JLabel(); + basicLafPercentSlider = new JSlider(); + basicLafPercentValue = new JLabel(); + JButton basicLafResetButton = new JButton(); + JLabel metalLafLabel = new JLabel(); + metalLafToolBar = new JToolBar(); + JPanel panel4 = new JPanel(); + JLabel metalLafMinLabel = new JLabel(); + metalLafMinSlider = new JSlider(); + metalLafMinValue = new JLabel(); + JButton metalLafResetButton = new JButton(); + JLabel metalLafMaxLabel = new JLabel(); + metalLafMaxSlider = new JSlider(); + metalLafMaxValue = new JLabel(); + JLabel plasticLabel = new JLabel(); + plasticToolBar = new JToolBar(); + JLabel intellijTextLabel = new JLabel(); + intellijTextToolBar = new JToolBar(); + intelliJTextFilterController = new FlatDisabledIconsTest.IntelliJFilterController(); + JLabel intellijLightLabel = new JLabel(); + intellijLightToolBar = new JToolBar(); + intelliJLightFilterController = new FlatDisabledIconsTest.IntelliJFilterController(); + JLabel intellijDarkLabel = new JLabel(); + intellijDarkToolBar = new JToolBar(); + intelliJDarkFilterController = new FlatDisabledIconsTest.IntelliJFilterController(); + JLabel netbeansLabel = new JLabel(); + netbeansToolBar = new JToolBar(); + zipToolBar = new JToolBar(); + zipButton = new JToggleButton(); + selectedCheckBox = new JCheckBox(); + + //======== this ======== + setLayout(new MigLayout( + "ltr,insets dialog,hidemode 3", + // columns + "[fill]" + + "[fill]" + + "[left]" + + "[fill]", + // rows + "[]" + + "[]" + + "[center]" + + "[center]" + + "[center]" + + "[center]" + + "[center]" + + "[center]" + + "[center]para" + + "[center]" + + "[]")); + + //---- enabledLabel ---- + enabledLabel.setText("enabled"); + add(enabledLabel, "cell 0 0"); + + //======== enabledToolBar ======== + { + + //---- button1 ---- + button1.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-cut24.gif"))); + enabledToolBar.add(button1); + + //---- button2 ---- + button2.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-copy24.gif"))); + enabledToolBar.add(button2); + + //---- button3 ---- + button3.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-paste24.gif"))); + enabledToolBar.add(button3); + + //---- button4 ---- + button4.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-undo24.gif"))); + enabledToolBar.add(button4); + + //---- button5 ---- + button5.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-redo24.gif"))); + enabledToolBar.add(button5); + + //---- button6 ---- + button6.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif"))); + enabledToolBar.add(button6); + + //---- button7 ---- + button7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png"))); + enabledToolBar.add(button7); + + //---- button8 ---- + button8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png"))); + enabledToolBar.add(button8); + + //---- button9 ---- + button9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png"))); + enabledToolBar.add(button9); + + //---- button10 ---- + button10.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png"))); + enabledToolBar.add(button10); + + //---- button11 ---- + button11.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png"))); + enabledToolBar.add(button11); + + //---- button12 ---- + button12.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png"))); + enabledToolBar.add(button12); + + //---- button13 ---- + button13.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png"))); + enabledToolBar.add(button13); + + //---- button14 ---- + button14.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png"))); + enabledToolBar.add(button14); + + //---- button15 ---- + button15.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png"))); + enabledToolBar.add(button15); + + //---- button16 ---- + button16.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png"))); + enabledToolBar.add(button16); + + //---- button17 ---- + button17.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png"))); + enabledToolBar.add(button17); + + //---- button18 ---- + button18.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png"))); + enabledToolBar.add(button18); + } + add(enabledToolBar, "cell 1 0"); + + //---- currentLabel ---- + currentLabel.setText("current LaF"); + add(currentLabel, "cell 0 1"); + add(currentLafToolBar, "cell 1 1"); + + //---- basicLafLabel ---- + basicLafLabel.setText("Basic LaF"); + add(basicLafLabel, "cell 0 2"); + add(basicLafToolBar, "cell 1 2"); + + //======== panel2 ======== + { + panel2.setLayout(new MigLayout( + "insets 0,hidemode 3,gap 0 0", + // columns + "[60,fill]" + + "[fill]" + + "[25,right]rel" + + "[fill]", + // rows + "[center]" + + "[center]")); + + //---- basicLafBrighterCheckBox ---- + basicLafBrighterCheckBox.setText("brighter"); + basicLafBrighterCheckBox.addActionListener(e -> basicLafChanged()); + panel2.add(basicLafBrighterCheckBox, "cell 0 0 2 1,alignx left,growx 0"); + + //---- basicLafPercentLabel ---- + basicLafPercentLabel.setText("Percent"); + panel2.add(basicLafPercentLabel, "cell 0 1"); + + //---- basicLafPercentSlider ---- + basicLafPercentSlider.setToolTipText("Percent"); + basicLafPercentSlider.setValue(0); + basicLafPercentSlider.addChangeListener(e -> basicLafChanged()); + panel2.add(basicLafPercentSlider, "cell 1 1"); + + //---- basicLafPercentValue ---- + basicLafPercentValue.setText("000"); + panel2.add(basicLafPercentValue, "cell 2 1"); + + //---- basicLafResetButton ---- + basicLafResetButton.setText("Reset"); + basicLafResetButton.addActionListener(e -> basicLafReset()); + panel2.add(basicLafResetButton, "cell 3 0 1 2"); + } + add(panel2, "cell 2 2"); + + //---- metalLafLabel ---- + metalLafLabel.setText("Metal LaF"); + add(metalLafLabel, "cell 0 3"); + add(metalLafToolBar, "cell 1 3"); + + //======== panel4 ======== + { + panel4.setLayout(new MigLayout( + "insets 0,hidemode 3,gap 0 0", + // columns + "[60,fill]" + + "[fill]" + + "[25,right]rel" + + "[fill]", + // rows + "[center]" + + "[center]")); + + //---- metalLafMinLabel ---- + metalLafMinLabel.setText("Min"); + panel4.add(metalLafMinLabel, "cell 0 0"); + + //---- metalLafMinSlider ---- + metalLafMinSlider.setMaximum(255); + metalLafMinSlider.addChangeListener(e -> metalLafChanged()); + panel4.add(metalLafMinSlider, "cell 1 0"); + + //---- metalLafMinValue ---- + metalLafMinValue.setText("000"); + panel4.add(metalLafMinValue, "cell 2 0"); + + //---- metalLafResetButton ---- + metalLafResetButton.setText("Reset"); + metalLafResetButton.addActionListener(e -> metalLafReset()); + panel4.add(metalLafResetButton, "cell 3 0 1 2"); + + //---- metalLafMaxLabel ---- + metalLafMaxLabel.setText("Max"); + panel4.add(metalLafMaxLabel, "cell 0 1"); + + //---- metalLafMaxSlider ---- + metalLafMaxSlider.setMaximum(255); + metalLafMaxSlider.addChangeListener(e -> metalLafChanged()); + panel4.add(metalLafMaxSlider, "cell 1 1"); + + //---- metalLafMaxValue ---- + metalLafMaxValue.setText("000"); + panel4.add(metalLafMaxValue, "cell 2 1"); + } + add(panel4, "cell 2 3"); + + //---- plasticLabel ---- + plasticLabel.setText("Plastic LaF"); + add(plasticLabel, "cell 0 4"); + add(plasticToolBar, "cell 1 4"); + + //---- intellijTextLabel ---- + intellijTextLabel.setText("IntelliJ text"); + add(intellijTextLabel, "cell 0 5"); + add(intellijTextToolBar, "cell 1 5"); + + //---- intelliJTextFilterController ---- + intelliJTextFilterController.addPropertyChangeListener("filter", e -> intelliJTextFilterChanged(e)); + add(intelliJTextFilterController, "cell 2 5"); + + //---- intellijLightLabel ---- + intellijLightLabel.setText("IntelliJ light"); + add(intellijLightLabel, "cell 0 6"); + add(intellijLightToolBar, "cell 1 6"); + + //---- intelliJLightFilterController ---- + intelliJLightFilterController.addPropertyChangeListener("filter", e -> intelliJLightFilterChanged(e)); + add(intelliJLightFilterController, "cell 2 6"); + + //---- intellijDarkLabel ---- + intellijDarkLabel.setText("IntelliJ dark"); + add(intellijDarkLabel, "cell 0 7"); + add(intellijDarkToolBar, "cell 1 7"); + + //---- intelliJDarkFilterController ---- + intelliJDarkFilterController.addPropertyChangeListener("filter", e -> intelliJDarkFilterChanged(e)); + add(intelliJDarkFilterController, "cell 2 7"); + + //---- netbeansLabel ---- + netbeansLabel.setText("NetBeans"); + add(netbeansLabel, "cell 0 8"); + add(netbeansToolBar, "cell 1 8"); + + //======== zipToolBar ======== + { + + //---- zipButton ---- + zipButton.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/zip128.png"))); + zipToolBar.add(zipButton); + } + add(zipToolBar, "cell 1 9 3 1"); + + //---- selectedCheckBox ---- + selectedCheckBox.setText("selected"); + selectedCheckBox.addActionListener(e -> selectedChanged()); + add(selectedCheckBox, "cell 0 10"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JToolBar enabledToolBar; + private JToolBar currentLafToolBar; + private JToolBar basicLafToolBar; + private JCheckBox basicLafBrighterCheckBox; + private JSlider basicLafPercentSlider; + private JLabel basicLafPercentValue; + private JToolBar metalLafToolBar; + private JSlider metalLafMinSlider; + private JLabel metalLafMinValue; + private JSlider metalLafMaxSlider; + private JLabel metalLafMaxValue; + private JToolBar plasticToolBar; + private JToolBar intellijTextToolBar; + private FlatDisabledIconsTest.IntelliJFilterController intelliJTextFilterController; + private JToolBar intellijLightToolBar; + private FlatDisabledIconsTest.IntelliJFilterController intelliJLightFilterController; + private JToolBar intellijDarkToolBar; + private FlatDisabledIconsTest.IntelliJFilterController intelliJDarkFilterController; + private JToolBar netbeansToolBar; + private JToolBar zipToolBar; + private JToggleButton zipButton; + private JCheckBox selectedCheckBox; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class IntelliJFilterController ------------------------------------ + + private static class IntelliJFilterController + extends JPanel + { + int defaultBrightness; + int defaultContrast; + + private IntelliJFilterController() { + initComponents(); + } + + private void changed() { + int brightness = intellijBrightnessSlider.getValue(); + int contrast = intellijContrastSlider.getValue(); + + intellijBrightnessValue.setText( String.valueOf( brightness ) ); + intellijContrastValue.setText( String.valueOf( contrast ) ); + + RGBImageFilter filter = new IntelliJGrayFilter( brightness, contrast, 100 ); + firePropertyChange( "filter", null, filter ); + } + + private void reset() { + intellijBrightnessSlider.setValue( defaultBrightness ); + intellijContrastSlider.setValue( defaultContrast ); + changed(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel intellijBrightnessLabel = new JLabel(); + intellijBrightnessSlider = new JSlider(); + intellijBrightnessValue = new JLabel(); + JLabel intellijContrastLabel = new JLabel(); + intellijContrastSlider = new JSlider(); + intellijContrastValue = new JLabel(); + JButton intellijLightResetButton = new JButton(); + + //======== this ======== + setLayout(new MigLayout( + "insets 0,hidemode 3,gap 0 0", + // columns + "[60,fill]" + + "[fill]" + + "[25,right]rel" + + "[fill]", + // rows + "[center]" + + "[center]")); + + //---- intellijBrightnessLabel ---- + intellijBrightnessLabel.setText("Brightness"); + add(intellijBrightnessLabel, "cell 0 0"); + + //---- intellijBrightnessSlider ---- + intellijBrightnessSlider.setMinimum(-100); + intellijBrightnessSlider.addChangeListener(e -> changed()); + add(intellijBrightnessSlider, "cell 1 0"); + + //---- intellijBrightnessValue ---- + intellijBrightnessValue.setText("000"); + add(intellijBrightnessValue, "cell 2 0"); + + //---- intellijContrastLabel ---- + intellijContrastLabel.setText("Contrast"); + add(intellijContrastLabel, "cell 0 1"); + + //---- intellijContrastSlider ---- + intellijContrastSlider.setMinimum(-100); + intellijContrastSlider.addChangeListener(e -> changed()); + add(intellijContrastSlider, "cell 1 1"); + + //---- intellijContrastValue ---- + intellijContrastValue.setText("-000"); + add(intellijContrastValue, "cell 2 1"); + + //---- intellijLightResetButton ---- + intellijLightResetButton.setText("Reset"); + intellijLightResetButton.addActionListener(e -> reset()); + add(intellijLightResetButton, "cell 3 0 1 2"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JSlider intellijBrightnessSlider; + private JLabel intellijBrightnessValue; + private JSlider intellijContrastSlider; + private JLabel intellijContrastValue; + // JFormDesigner - End of variables declaration //GEN-END:variables + } + + //---- class FilterButton ------------------------------------------------- + + private static class FilterButton + extends JToggleButton + { + private RGBImageFilter filter; + + FilterButton( RGBImageFilter filter, Icon icon ) { + this.filter = filter; + + setEnabled( false ); + setIcon( icon ); + + if( filter != null ) + updateDisabledIcon(); + } + + void setFilter( RGBImageFilter filter ) { + this.filter = filter; + updateDisabledIcon(); + } + + @Override + public void updateUI() { + super.updateUI(); + updateDisabledIcon(); + } + + private void updateDisabledIcon() { + setDisabledIcon( createDisabledIcon( getIcon() ) ); + } + + protected Icon createDisabledIcon( Icon icon ) { + if( !(icon instanceof ImageIcon) ) + return null; + + Image image = ((ImageIcon) icon).getImage(); + ImageProducer producer = new FilteredImageSource( image.getSource(), filter ); + Image disabledImage = Toolkit.getDefaultToolkit().createImage( producer ); + return new ImageIcon( disabledImage ); + } + } + + //---- class PlasticRGBGrayFilter ----------------------------------------- + + // from https://github.com/openjdk/jdk/blob/6bab0f539fba8fb441697846347597b4a0ade428/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalUtils.java#L415-L434 + // license https://github.com/openjdk/jdk/blob/master/LICENSE + private static class MetalDisabledButtonImageFilter + extends RGBImageFilter + { + private final float min; + private final float factor; + + MetalDisabledButtonImageFilter(int min, int max) { + canFilterIndexColorModel = true; + this.min = min; + this.factor = (max - min) / 255f; + } + + @Override + public int filterRGB(int x, int y, int rgb) { + // Coefficients are from the sRGB color space: + int gray = Math.min(255, (int)(((0.2125f * ((rgb >> 16) & 0xFF)) + + (0.7154f * ((rgb >> 8) & 0xFF)) + + (0.0721f * (rgb & 0xFF)) + .5f) * factor + min)); + + return (rgb & 0xff000000) | (gray << 16) | (gray << 8) | + (gray << 0); + } + } + + //---- class PlasticRGBGrayFilter ----------------------------------------- + + // from https://github.com/JFormDesigner/swing-jgoodies-looks/blob/master/src/main/java/com/jgoodies/looks/common/RGBGrayFilter.java + // license https://github.com/JFormDesigner/swing-jgoodies-looks/blob/master/LICENSE.txt + private static final class PlasticRGBGrayFilter + extends RGBImageFilter + { + private PlasticRGBGrayFilter() { + canFilterIndexColorModel = true; + } + + @Override + public int filterRGB(int x, int y, int rgb) { + // Find the average of red, green, and blue. + float avg = (((rgb >> 16) & 0xff) / 255f + + ((rgb >> 8) & 0xff) / 255f + + (rgb & 0xff) / 255f) / 3; + // Pull out the alpha channel. + float alpha = (((rgb >> 24) & 0xff) / 255f); + + // Calculate the average. + // Sun's formula: Math.min(1.0f, (1f - avg) / (100.0f / 35.0f) + avg); + // The following formula uses less operations and hence is faster. + avg = Math.min(1.0f, 0.35f + 0.65f * avg); + // Convert back into RGB. + return (int) (alpha * 255f) << 24 | + (int) (avg * 255f) << 16 | + (int) (avg * 255f) << 8 | + (int) (avg * 255f); + } + } + + //---- class IntelliJGrayFilter ------------------------------------------- + + // from https://github.com/JetBrains/intellij-community/blob/3840eab54746f5c4f301bb3ac78f00a980b5fd6e/platform/util/ui/src/com/intellij/util/ui/UIUtil.java#L253-L347 + // license https://github.com/JetBrains/intellij-community/blob/master/LICENSE.txt + private static class IntelliJGrayFilter + extends RGBImageFilter + { + private float brightness; + private float contrast; + private int alpha; + + private int origContrast; + private int origBrightness; + + /** + * @param brightness in range [-100..100] where 0 has no effect + * @param contrast in range [-100..100] where 0 has no effect + * @param alpha in range [0..100] where 0 is transparent, 100 has no effect + */ + public IntelliJGrayFilter(int brightness, int contrast, int alpha) { + setBrightness(brightness); + setContrast(contrast); + setAlpha(alpha); + } + + private void setBrightness(int brightness) { + origBrightness = Math.max(-100, Math.min(100, brightness)); + this.brightness = (float)(Math.pow(origBrightness, 3) / (100f * 100f)); // cubic in [0..100] + } + + private void setContrast(int contrast) { + origContrast = Math.max(-100, Math.min(100, contrast)); + this.contrast = origContrast / 100f; + } + + private void setAlpha(int alpha) { + this.alpha = Math.max(0, Math.min(100, alpha)); + } + + @Override + public int filterRGB(int x, int y, int rgb) { + // Use NTSC conversion formula. + int gray = (int)(0.30 * (rgb >> 16 & 0xff) + + 0.59 * (rgb >> 8 & 0xff) + + 0.11 * (rgb & 0xff)); + + if (brightness >= 0) { + gray = (int)((gray + brightness * 255) / (1 + brightness)); + } + else { + gray = (int)(gray / (1 - brightness)); + } + + if (contrast >= 0) { + if (gray >= 127) { + gray = (int)(gray + (255 - gray) * contrast); + } + else { + gray = (int)(gray - gray * contrast); + } + } + else { + gray = (int)(127 + (gray - 127) * (contrast + 1)); + } + + int a = ((rgb >> 24) & 0xff) * alpha / 100; + + return (a << 24) | (gray << 16) | (gray << 8) | gray; + } + } + + //---- NetBeansDisabledButtonFilter --------------------------------------- + + // from https://github.com/apache/netbeans/blob/166e2bb491c29f6778223c6e9e16f70664252bce/platform/openide.util.ui/src/org/openide/util/ImageUtilities.java#L1202-L1221 + // license https://github.com/apache/netbeans/blob/master/LICENSE + private static class NetBeansDisabledButtonFilter + extends RGBImageFilter + { + NetBeansDisabledButtonFilter() { + canFilterIndexColorModel = true; + } + + @Override + public int filterRGB(int x, int y, int rgb) { + // Reduce the color bandwidth in quarter (>> 2) and Shift 0x88. + return (rgb & 0xff000000) + 0x888888 + ((((rgb >> 16) & 0xff) >> 2) << 16) + ((((rgb >> 8) & 0xff) >> 2) << 8) + (((rgb) & 0xff) >> 2); + } + } +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.jfd new file mode 100644 index 00000000..b0773567 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatDisabledIconsTest.jfd @@ -0,0 +1,458 @@ +JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + auxiliary() { + "JavaCodeGenerator.defaultVariableLocal": true + } + add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "ltr,insets dialog,hidemode 3" + "$columnConstraints": "[fill][fill][left][fill]" + "$rowConstraints": "[][][center][center][center][center][center][center][center]para[center][]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "enabledLabel" + "text": "enabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "enabledToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button1" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-cut24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button2" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-copy24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button3" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-paste24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button4" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-undo24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button5" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-redo24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button6" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button7" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button8" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button9" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button10" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button11" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button12" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button13" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button14" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button15" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button16" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button17" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button18" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png" ) + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "currentLabel" + "text": "current LaF" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "currentLafToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "basicLafLabel" + "text": "Basic LaF" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "basicLafToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 0,hidemode 3,gap 0 0" + "$columnConstraints": "[60,fill][fill][25,right]rel[fill]" + "$rowConstraints": "[center][center]" + } ) { + name: "panel2" + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "basicLafBrighterCheckBox" + "text": "brighter" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "basicLafChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0 2 1,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "basicLafPercentLabel" + "text": "Percent" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "basicLafPercentSlider" + "toolTipText": "Percent" + "value": 0 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "basicLafChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "basicLafPercentValue" + "text": "000" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "basicLafResetButton" + "text": "Reset" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "basicLafReset", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0 1 2" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "metalLafLabel" + "text": "Metal LaF" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "metalLafToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 0,hidemode 3,gap 0 0" + "$columnConstraints": "[60,fill][fill][25,right]rel[fill]" + "$rowConstraints": "[center][center]" + } ) { + name: "panel4" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "metalLafMinLabel" + "text": "Min" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "metalLafMinSlider" + "maximum": 255 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "metalLafChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "metalLafMinValue" + "text": "000" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "metalLafResetButton" + "text": "Reset" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "metalLafReset", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0 1 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "metalLafMaxLabel" + "text": "Max" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "metalLafMaxSlider" + "maximum": 255 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "metalLafChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "metalLafMaxValue" + "text": "000" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "plasticLabel" + "text": "Plastic LaF" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "plasticToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijTextLabel" + "text": "IntelliJ text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "intellijTextToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatDisabledIconsTest$IntelliJFilterController" ) { + name: "intelliJTextFilterController" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.beans.PropertyChangeListener", "propertyChange", "intelliJTextFilterChanged", true, "filter" ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 5" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijLightLabel" + "text": "IntelliJ light" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "intellijLightToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatDisabledIconsTest$IntelliJFilterController" ) { + name: "intelliJLightFilterController" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.beans.PropertyChangeListener", "propertyChange", "intelliJLightFilterChanged", true, "filter" ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 6" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijDarkLabel" + "text": "IntelliJ dark" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "intellijDarkToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatDisabledIconsTest$IntelliJFilterController" ) { + name: "intelliJDarkFilterController" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.beans.PropertyChangeListener", "propertyChange", "intelliJDarkFilterChanged", true, "filter" ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 7" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "netbeansLabel" + "text": "NetBeans" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 8" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "netbeansToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "zipToolBar" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "zipButton" + "icon": new com.jformdesigner.model.SwingIcon( 0, "/com/formdev/flatlaf/testing/disabled_icons_test/zip128.png" ) + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9 3 1" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "selectedCheckBox" + "text": "selected" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "selectedChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 1095, 625 ) + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 0,hidemode 3,gap 0 0" + "$columnConstraints": "[60,fill][fill][25,right]rel[fill]" + "$rowConstraints": "[center][center]" + } ) { + name: "panel1" + auxiliary() { + "JavaCodeGenerator.className": "IntelliJFilterController" + } + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijBrightnessLabel" + "text": "Brightness" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "intellijBrightnessSlider" + "minimum": -100 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changed", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijBrightnessValue" + "text": "000" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijContrastLabel" + "text": "Contrast" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "intellijContrastSlider" + "minimum": -100 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changed", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "intellijContrastValue" + "text": "-000" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "intellijLightResetButton" + "text": "Reset" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "reset", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0 1 2" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 660 ) + "size": new java.awt.Dimension( 286, 39 ) + } ) + } +} diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/LICENSE.txt b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/LICENSE.txt new file mode 100644 index 00000000..bc63f393 --- /dev/null +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/LICENSE.txt @@ -0,0 +1,12 @@ +The icons in this folder starting with 'intellij-' are from IntelliJ IDEA Community Edition, +which is licensed under the Apache 2.0 license. Copyright 2000-2020 JetBrains s.r.o. +See: https://github.com/JetBrains/intellij-community/ + +The icons in this folder starting with 'netbeans-' are from Apache NetBeans, +which is licensed under the Apache 2.0 license to the Apache Software Foundation (ASF). +See: https://github.com/apache/netbeans/ + +zip128.png is from +http://www.iconarchive.com/show/plump-icons-by-zerode/Folder-Archive-zip-icon.html +License: Free for non-commercial use. +Commercial usage: Not allowed diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png new file mode 100644 index 00000000..c49ce722 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png new file mode 100644 index 00000000..72ba5d31 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png new file mode 100644 index 00000000..0563a7ab Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png new file mode 100644 index 00000000..9df8e303 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png new file mode 100644 index 00000000..2b2b1b9c Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png new file mode 100644 index 00000000..fa13a324 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png new file mode 100644 index 00000000..06c417d3 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png new file mode 100644 index 00000000..63ca47e5 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png new file mode 100644 index 00000000..9857cce2 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png new file mode 100644 index 00000000..682bc81f Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png new file mode 100644 index 00000000..c006c56f Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png new file mode 100644 index 00000000..b1a2398e Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-copy24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-copy24.gif new file mode 100644 index 00000000..5a50e326 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-copy24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-cut24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-cut24.gif new file mode 100644 index 00000000..2520d4ec Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-cut24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif new file mode 100644 index 00000000..7424e382 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-paste24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-paste24.gif new file mode 100644 index 00000000..65c0ec02 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-paste24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-redo24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-redo24.gif new file mode 100644 index 00000000..e4288af1 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-redo24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-undo24.gif b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-undo24.gif new file mode 100644 index 00000000..e2c01c01 Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-undo24.gif differ diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/zip128.png b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/zip128.png new file mode 100644 index 00000000..0fd07dbd Binary files /dev/null and b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/disabled_icons_test/zip128.png differ