Testing: FlatDisabledIconsTest: use intellij dark icons in dark themes
@@ -17,6 +17,7 @@
|
|||||||
package com.formdev.flatlaf.testing;
|
package com.formdev.flatlaf.testing;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.image.FilteredImageSource;
|
import java.awt.image.FilteredImageSource;
|
||||||
@@ -24,6 +25,7 @@ import java.awt.image.ImageProducer;
|
|||||||
import java.awt.image.RGBImageFilter;
|
import java.awt.image.RGBImageFilter;
|
||||||
import java.beans.*;
|
import java.beans.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
import net.miginfocom.swing.*;
|
import net.miginfocom.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,53 +268,17 @@ public class FlatDisabledIconsTest
|
|||||||
//---- button6 ----
|
//---- button6 ----
|
||||||
button6.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif")));
|
button6.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/netbeans-find24.gif")));
|
||||||
enabledToolBar.add(button6);
|
enabledToolBar.add(button6);
|
||||||
|
|
||||||
//---- button7 ----
|
|
||||||
button7.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png")));
|
|
||||||
enabledToolBar.add(button7);
|
enabledToolBar.add(button7);
|
||||||
|
|
||||||
//---- button8 ----
|
|
||||||
button8.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png")));
|
|
||||||
enabledToolBar.add(button8);
|
enabledToolBar.add(button8);
|
||||||
|
|
||||||
//---- button9 ----
|
|
||||||
button9.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png")));
|
|
||||||
enabledToolBar.add(button9);
|
enabledToolBar.add(button9);
|
||||||
|
|
||||||
//---- button10 ----
|
|
||||||
button10.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png")));
|
|
||||||
enabledToolBar.add(button10);
|
enabledToolBar.add(button10);
|
||||||
|
|
||||||
//---- button11 ----
|
|
||||||
button11.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png")));
|
|
||||||
enabledToolBar.add(button11);
|
enabledToolBar.add(button11);
|
||||||
|
|
||||||
//---- button12 ----
|
|
||||||
button12.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png")));
|
|
||||||
enabledToolBar.add(button12);
|
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);
|
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);
|
enabledToolBar.add(button14);
|
||||||
|
|
||||||
//---- button15 ----
|
|
||||||
button15.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png")));
|
|
||||||
enabledToolBar.add(button15);
|
enabledToolBar.add(button15);
|
||||||
|
|
||||||
//---- button16 ----
|
|
||||||
button16.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png")));
|
|
||||||
enabledToolBar.add(button16);
|
enabledToolBar.add(button16);
|
||||||
|
|
||||||
//---- button17 ----
|
|
||||||
button17.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png")));
|
|
||||||
enabledToolBar.add(button17);
|
enabledToolBar.add(button17);
|
||||||
|
|
||||||
//---- button18 ----
|
|
||||||
button18.setIcon(new ImageIcon(getClass().getResource("/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png")));
|
|
||||||
enabledToolBar.add(button18);
|
enabledToolBar.add(button18);
|
||||||
}
|
}
|
||||||
add(enabledToolBar, "cell 1 0");
|
add(enabledToolBar, "cell 1 0");
|
||||||
@@ -468,6 +434,44 @@ public class FlatDisabledIconsTest
|
|||||||
selectedCheckBox.addActionListener(e -> selectedChanged());
|
selectedCheckBox.addActionListener(e -> selectedChanged());
|
||||||
add(selectedCheckBox, "cell 0 10");
|
add(selectedCheckBox, "cell 0 10");
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
|
||||||
|
button7.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut_dark.png" ) );
|
||||||
|
button8.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste_dark.png" ) );
|
||||||
|
button9.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show_dark.png" ) );
|
||||||
|
button10.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess_dark.png" ) );
|
||||||
|
button11.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess_dark.png" ) );
|
||||||
|
button12.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search_dark.png" ) );
|
||||||
|
|
||||||
|
button13.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-cut@2x_dark.png" ) );
|
||||||
|
button14.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-menu-paste@2x_dark.png" ) );
|
||||||
|
button15.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-show@2x_dark.png" ) );
|
||||||
|
button16.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showReadAccess@2x_dark.png" ) );
|
||||||
|
button17.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-showWriteAccess@2x_dark.png" ) );
|
||||||
|
button18.setIcon( new LightOrDarkIcon(
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x.png",
|
||||||
|
"/com/formdev/flatlaf/testing/disabled_icons_test/intellij-search@2x_dark.png" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
@@ -495,6 +499,49 @@ public class FlatDisabledIconsTest
|
|||||||
private JCheckBox selectedCheckBox;
|
private JCheckBox selectedCheckBox;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|
||||||
|
//---- class LightOrDarkIcon ----------------------------------------------
|
||||||
|
|
||||||
|
private static class LightOrDarkIcon
|
||||||
|
extends ImageIcon
|
||||||
|
{
|
||||||
|
private final ImageIcon lightIcon;
|
||||||
|
private final ImageIcon darkIcon;
|
||||||
|
|
||||||
|
LightOrDarkIcon( String lightIconName, String darkIconName ) {
|
||||||
|
this.lightIcon = new ImageIcon( getClass().getResource( lightIconName ) );
|
||||||
|
this.darkIcon = new ImageIcon( getClass().getResource( darkIconName ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private ImageIcon getCurrentIcon() {
|
||||||
|
return isDark() ? darkIcon : lightIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDark() {
|
||||||
|
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
|
||||||
|
return lookAndFeel instanceof FlatLaf && ((FlatLaf)lookAndFeel).isDark();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconWidth() {
|
||||||
|
return getCurrentIcon().getIconWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getIconHeight() {
|
||||||
|
return getCurrentIcon().getIconHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized void paintIcon( Component c, Graphics g, int x, int y ) {
|
||||||
|
getCurrentIcon().paintIcon( c, g, x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Image getImage() {
|
||||||
|
return getCurrentIcon().getImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---- class IntelliJFilterController ------------------------------------
|
//---- class IntelliJFilterController ------------------------------------
|
||||||
|
|
||||||
private static class IntelliJFilterController
|
private static class IntelliJFilterController
|
||||||
|
|||||||
@@ -49,51 +49,39 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button7"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button8"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button9"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button10"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button11"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button12"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button13"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button14"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button15"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button16"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button17"
|
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" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "button18"
|
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 ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 0"
|
"value": "cell 1 0"
|
||||||
|
|||||||
|
After Width: | Height: | Size: 536 B |
|
After Width: | Height: | Size: 285 B |
|
After Width: | Height: | Size: 124 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 687 B |
|
After Width: | Height: | Size: 308 B |
|
After Width: | Height: | Size: 467 B |
|
After Width: | Height: | Size: 511 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 492 B |
|
After Width: | Height: | Size: 330 B |
|
After Width: | Height: | Size: 273 B |