JMenu cbMenu = new JMenu("Color blindness");
JMenuItem protanopiaCurrent = new JMenuItem(
"Protanopia current");
protanopiaCurrent
.addActionListener(new SkinChanger(
new ColorSchemeTransform() {
public SubstanceColorScheme transform(
SubstanceColorScheme scheme) {
return new ProtanopiaColorScheme(
scheme);
}
}, "Protanopia current"));
cbMenu.add(protanopiaCurrent);
JMenuItem deuteranopiaCurrent = new JMenuItem(
"Deuteranopia current");
deuteranopiaCurrent
.addActionListener(new SkinChanger(
new ColorSchemeTransform() {
public SubstanceColorScheme transform(
SubstanceColorScheme scheme) {
return new DeuteranopiaColorScheme(
scheme);
}
}, "Deuteranopia current"));
cbMenu.add(deuteranopiaCurrent);
JMenuItem tritanopiaCurrent = new JMenuItem(
"Tritanopia current");
tritanopiaCurrent
.addActionListener(new SkinChanger(
new ColorSchemeTransform() {
public SubstanceColorScheme transform(
SubstanceColorScheme scheme) {
return new TritanopiaColorScheme(
scheme);
}
}, "Tritanopia current"));
cbMenu.add(tritanopiaCurrent);
cbMenu.addSeparator();
JMenuItem restoreOriginal = new JMenuItem(
"Restore original");
if (SubstanceLookAndFeel.getCurrentSkin(null)
.getColorScheme(null,
ComponentState.ENABLED) instanceof ColorBlindColorScheme) {
restoreOriginal
.addActionListener(new SkinChanger(
new ColorSchemeTransform() {
public SubstanceColorScheme transform(
SubstanceColorScheme scheme) {
if (scheme instanceof ColorBlindColorScheme)
return ((ColorBlindColorScheme) scheme)
.getOrigScheme();