package org.jasip.app.alphabet;

import org.jasip.Jasip;

/**
 * Displays an alphabet and the string "hit 'q' to leave!".
 */
public class Alphabet {
    Alphabet() {
    }
    /**
     * Writes the alphabet on the first line.
     */
    void write () {
	for (int i=0;i<26;++i) {
	    Jasip.term.setChar(i,0,(char)(i+65));
	}
    }
    /**
     * Diplay a String at position (x,y) on the Jasip screen.
     * @param x horizontal coordinate.
     * @param y vertical coordinate.
     * @param s String to be displayed on the screen.
     */
    public static void displayString(int x, int y, String s) {
	char [] b = s.toCharArray();
	for (int i=0;i<s.length();++i) {
	    Jasip.term.setChar(x+i,y,b[i]);
	}
    }
    public static void main() {
	Alphabet a = new Alphabet();
	a.write();
	displayString(0,1,"hit 'q' to leave!");
	while (Jasip.kbd.getNextChar()!='q') {}
    }
}
