import java.awt.*;import java.io.*;import javax.swing.*;public class Kariert extends JFrame { private Graphics dbg; StreamTokenizer tokenizer; //BufferedReader in; FileInputStream is; BufferedReader r; //Reader r String board[][] = new String[18][42]; String message = ""; int boardint[][] = new int[18][42]; int count1 = 0; int count2 = 0; int boardx = 0; int boardy = 0; int blocksizex = 7; int blocksizey = 16; int token; public Kariert() { try { //in = new BufferedReader( //new FileReader("Kopie von Mappe.txt")); //tokenizer = new StreamTokenizer(in); is = new FileInputStream("Kopie von Mappe.txt"); r = new BufferedReader( new InputStreamReader(is)); tokenizer = new StreamTokenizer(r); tokenizer.parseNumbers(); tokenizer.wordChars('c', 'c'); tokenizer.wordChars('w', 'w'); tokenizer.wordChars('n', 'n'); tokenizer.wordChars('s', 's'); tokenizer.wordChars('e', 'e'); //tokenizer.wordChars('0', ' '); tokenizer.ordinaryChars(0, ' '); tokenizer.whitespaceChars(' ',' '); tokenizer.eolIsSignificant(true); tokenizer.slashStarComments(true); tokenizer.slashSlashComments(true); while ((token = tokenizer.nextToken()) != StreamTokenizer.TT_EOF) { switch (token) { case StreamTokenizer.TT_WORD: message = "Word: " + tokenizer.sval; board[count1][count2] = tokenizer.sval; count2++; break; case StreamTokenizer.TT_EOL: count1++; break; case StreamTokenizer.TT_EOF: count1 = 0; count2 = 0; break; //default: //char ch = (char)tokenizer.ttype; //break; } } for(count1 = 0; count1 <= 16; count1++) { for(count2 = 0; count2 <= 40; count2++) { boardint[count1][count2] = Integer.parseInt(board[count1][count2]); } } for(count1 = 0; count1 <= 16; count1++) { if(count1 != 0) { boardy+=blocksizey; boardx = 0; } for(count2 = 0; count2 <= 40; count2++) { switch (boardint[count1][count2]) { case 'n': if(dbg == null) { dbg = getGraphics(); } dbg.setColor(Color.blue); break; default: if(dbg == null) { dbg = getGraphics(); } dbg.setColor(Color.black); break; } paint(dbg); boardx+=blocksizex; } } } catch (IOException e) { } } public void paint(Graphics g) { g.drawRect(boardx,boardy,blocksizex,blocksizey); g.fillRect(boardx,boardy,blocksizex,blocksizey); } public void update(Graphics g) { paint(g); } public static void main(String args[]) { Kariert neu = new Kariert(); neu.setSize(294,288); neu.setLocation(100,100); neu.setVisible(true); } }