The following text was written to the standard output stream when the Synesthesia code program was executed from IntelliJ.
/* *Program to simulate the phenomenon known as grapheme to color synesthesia. * This program is written as an interpreter that recognizes and responds to: * -exit | terminate the program * -remap | redefine the mapping from letters to colors * -word or phrase | simply show the word or phrase in synesthetic color */ package synesthesia; import painter.SPainter; import java.awt.Point; import javax.swing.*; import java.awt.*; public class GraphemeToColorSynesthesia { private static final int fontsize = 30; private static final String theLetters = "Abcdefghijklmnopqrstuvwxyz"; private static String[] letters; private static Color[] colors; private void paintingCode(){ //initialization SPainter miro = new SPainter("SYNESTHESIA" ,1200, 220); miro.setScreenLocation(30,30); miro.setFontSize(fontsize); initializeColorMap(theLetters); //interpretation while (true) { String input = JOptionPane.showInputDialog(null, "Please enter a word, or a few words ..."); if(input == null) {input= "EXIT";} input = input.toUpperCase(); if(input.equals("EXIT")){ break; }else if (input.equals("REMAP")){ initializeColorMap(theLetters); showLetters(miro, theLetters); }else{ showLetters(miro,input.toUpperCase()); } } miro.end(); } private static void showLetters(SPainter miro, String input){ //ready eraseWhiteBoard(miro); //set miro.moveTo(new Point.Double(100,100)); //go for (int i = 0; i < input.length(); i = i+1){ String letter = input.substring(i, i+1); Color color = getLetterColor(letter); miro.setColor(color); miro.draw(letter); miro.mrt(fontsize); } } private static void initializeColorMap(String specialLettters){ letters = new String[specialLettters.length()]; colors = new Color[specialLettters.length()]; for(int i = 0; i < specialLettters.length(); i = i+1){ letters[i] = specialLettters.substring(i,i+1); colors[i] = randomColor(); } } private static Color getLetterColor(String letter){ for (int i = 0; i < letters.length; i = i+1){ if (letter.equalsIgnoreCase(letters[i])){ return colors[i]; } } return Color.BLACK; } private static Color randomColor(){ int rv = (int) (Math.random()*256); int gv = (int) (Math.random()* 256); int bv = (int) (Math.random()* 256); return new Color(rv,gv,bv); } private static void eraseWhiteBoard(SPainter miro){ miro.setColor(Color.WHITE); miro.wash(); miro.paintFrame(Color.black, 5); } //infrastructure for some simple painting public GraphemeToColorSynesthesia(){ paintingCode(); } public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable(){ public void run(){ new GraphemeToColorSynesthesia(); } }); } }