import java.awt.*;public class Brailler {  public static final String[] dotCodes =      { "      ", " ooo o", "    o ", "  oooo", "oo o o", "o  o o", "oooo o", "  o   ",   // space, !, ", #, $, %, &, '       "ooo oo", " ooooo", "o    o", "  oo o", "     o", "  o  o", "   o o", "  oo  ",   // (, ), *, +, comma, -, ., /       "  o oo", " o    ", " oo   ", " o  o ", " o  oo", " o   o", " oo o ", " oo oo",   // 0-7       " oo  o", "  o o ", "o   oo", "    oo", "oo   o", "oooooo", "  ooo ", "o  ooo",   // 8, 9, :, ;, <, =, >, ?       "   o  ", "o     ", "oo    ", "o  o  ", "o  oo ", "o   o ", "oo o  ", "oo oo ",   // @, A-G       "oo  o ", " o o  ", " o oo ", "o o   ", "ooo   ", "o oo  ", "o ooo ", "o o o ",   // H-O       "oooo  ", "ooooo ", "ooo o ", " ooo  ", " oooo ", "o o  o", "ooo  o", " o ooo",   // P-W       "o oo o", "o oooo", "o o oo", " o o o", "oo  oo", "oo ooo", "   oo ", "   ooo" }; // X-Z, [, \, ], ^, _  public int dx, dy, dw, dh, charw, charh;  public Brailler(int dw, int dh, int dx, int dy, int charw, int charh) {    this.dw = dw;    this.dh = dh;    this.dx = dx;    this.dy = dy;    this.charw = charw;    this.charh = charh;  }  public void draw(String s, Rectangle r, Graphics g) {    if (s==null) return;    int x=r.x, y=r.y, curw;    StringBuffer curWord;    for(int i=0; i<s.length(); ) {      curWord = new StringBuffer();      while(i<s.length() && !Character.isWhitespace(s.charAt(i))) {        curWord.append(s.charAt(i));        i++;      }      while(i<s.length() && Character.isWhitespace(s.charAt(i))) {        curWord.append(s.charAt(i));        i++;      }      if (x+curWord.length()*charw > r.width) {        x  = r.x;        y += charh;      }      //System.out.println("drawing "+curWord);      for(int j=0; j<curWord.length(); j++) {        drawChar(curWord.charAt(j), x, y, g);        x += charw;        if (curWord.charAt(j)=='\r' || curWord.charAt(j)=='\n') {          x = r.x+charw*3;          y += charh;        }      }    }  }  public void drawChar(char c, int x, int y, Graphics g) {    if (Character.isWhitespace(c)) return;    boolean[] dots = getDots(c);    if (dots == null) {      g.drawString(""+c, x, y+dy*3);    }    else {      for(int i=0; i<3; i++) {        if (dots[i  ]) g.fillRect(x   , y+i*dy, dw, dh);        if (dots[i+3]) g.fillRect(x+dx, y+i*dy, dw, dh);      }    }  }    public static boolean[] getDots(char c) {    if (c<32 || c>95) return null;    else {      String dots = dotCodes[c-32];      boolean[] b = { dots.charAt(0) !=  ' ', dots.charAt(1) !=  ' ', dots.charAt(2) !=  ' ',                       dots.charAt(3) !=  ' ', dots.charAt(4) !=  ' ', dots.charAt(5) !=  ' '   };      return b;    }  }      public static void main(String[] args) throws Exception {    String s=args[0];    for(int i=1; i<args.length; i++) s = s + " " + args[i];    final String fs = s;    final Brailler b = new Brailler(5,5,8,8,20,30);    final Frame f = new Frame() {      public void paint(Graphics g) {        b.draw(fs, new Rectangle(0,0,300,100), g);      }    };    f.setSize(300,300);    f.show();  }      }