BlinkenApplet/Lauftext Schriftarten/MorseCode

From S23Wiki
Jump to: navigation, search

BlinkenApplet->Lauftext Schriftarten->MorseCode

<blinken delay=1 bgcolor="255,255,255" lamponcolor="70,240,70" lampoffcolor="255,255,255" font="MorseCode">This font is called MorseCode</blinken>

Schönes Beispiel wie man weitere Schritftarten ausser der Std-Schrift 5pxStd machen kann:

/**
 * 
 * BlinkenApplet
 * Copyright (C) 2006: Guido Pannenbecker <took@sd-gp.de>
 * initiated by Manuel Flöther
 * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
 * a blinkenarea.org project
 * 
 * Klasse: MorseSchriftart
 *
 * Definiert Standart-Schriftart für Lauftext.
 *
 *
 * Created by: Guido Pannenbecker
 * Date: 2006-06-11
 *
 * History:
 *
 * 2006-06-11, Guido: new
 * 
 */
package baLauftext;

public class MorseSchriftart extends Schriftart {
 
  public MorseSchriftart() {
  }

  public int getFontHeight(){
    return 1;
  }
  
  public boolean isValidChar(String ch) {
    return "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ".indexOf(ch)>=0;
  }
 
  
  public String getCharRow(String ch, int row){
    ch=ch.toUpperCase();
    if (ch.equals("A")) {
        switch (row) {
        case 1: return "10111000";
        default: return null;
        }
      } else if (ch.equals("B")) {
        switch (row) {
        case 1: return "111010101000";
        default: return null;
        }
      } else if (ch.equals("C")) {
        switch (row) {
        case 1: return "11101011101000";
        default: return null;
        }        
      } else if (ch.equals("D")) {
        switch (row) {
        case 1: return "1110101000";
        default: return null;
        }        
      } else if (ch.equals("E")) {
        switch (row) {
        case 1: return "1000";
        default: return null;
        }        
      } else if (ch.equals("F")) {
        switch (row) {
        case 1: return "101011101000";
        default: return null;
        }        
      } else if (ch.equals("G")) {
        switch (row) {
        case 1: return "111011101000";
        default: return null;
        }        
      } else if (ch.equals("H")) {
        switch (row) {
        case 1: return "1010101000";
        default: return null;
        }        
      } else if (ch.equals("I")) {
        switch (row) {
        case 1: return "101000";
        default: return null;
        }        
      } else if (ch.equals("J")) {
        switch (row) {
        case 1: return "1011101110111000";
        default: return null;
        }        
      } else if (ch.equals("K")) {
        switch (row) {
        case 1: return "111010111000";
        default: return null;
        }        
      } else if (ch.equals("L")) {
        switch (row) {
        case 1: return "101110101000";
        default: return null;
        }        
      } else if (ch.equals("M")) {
        switch (row) {
        case 1: return "1110111000";
        default: return null;
        }        
      } else if (ch.equals("N")) {
        switch (row) {
        case 1: return "11101000";
        default: return null;
        }        
      } else if (ch.equals("O")) {
        switch (row) {
        case 1: return "11101110111000";
        default: return null;
        }        
      } else if (ch.equals("P")) {
        switch (row) {
        case 1: return "10111011101000";
        default: return null;
        }        
      } else if (ch.equals("Q")) {
        switch (row) {
        case 1: return "1110111010111000";
        default: return null;
        }        
      } else if (ch.equals("R")) {
        switch (row) {
        case 1: return "1011101000";
        default: return null;
        }        
      } else if (ch.equals("S")) {
        switch (row) {
        case 1: return "10101000";
        default: return null;
        }        
      } else if (ch.equals("T")) {
        switch (row) {
        case 1: return "111000";
        default: return null;
        }        
      } else if (ch.equals("U")) {
        switch (row) {
        case 1: return "1010111000";
        default: return null;
        }        
      } else if (ch.equals("V")) {
        switch (row) {
        case 1: return "101010111000";
        default: return null;
        }        
      } else if (ch.equals("W")) {
        switch (row) {
        case 1: return "101110111000";
        default: return null;
        }        
      } else if (ch.equals("X")) {
        switch (row) {
        case 1: return "11101010111000";
        default: return null;
        }        
      } else if (ch.equals("Y")) {
        switch (row) {
        case 1: return "1110101110111000";
        default: return null;
        }        
      } else if (ch.equals("Z")) {
        switch (row) {
        case 1: return "11101110101000";
        default: return null;
        }        
      } else if (ch.equals("0")) {
        switch (row) {
        case 1: return "1110111011101110111000";
        default: return null;
        }  
      } else if (ch.equals("1")) {
        switch (row) {
        case 1: return "10111011101110111000";
        default: return null;
        }  
      } else if (ch.equals("2")) {
        switch (row) {
        case 1: return "101011101110111000";
        default: return null;
        }  
      } else if (ch.equals("3")) {
        switch (row) {
        case 1: return "1010101110111000";
        default: return null;
        }  
      } else if (ch.equals("4")) {
        switch (row) {
        case 1: return "10101010111000";
        default: return null;
        }  
      } else if (ch.equals("5")) {
        switch (row) {
        case 1: return "101010101000";
        default: return null;
        }  
      } else if (ch.equals("6")) {
        switch (row) {
        case 1: return "11101010101000";
        default: return null;
        }  
      } else if (ch.equals("7")) {
        switch (row) {
        case 1: return "1110111010101000";
        default: return null;
        }  
      } else if (ch.equals("8")) {
        switch (row) {
        case 1: return "111011101110101000";
        default: return null;
        }  
      } else if (ch.equals("9")) {
        switch (row) {
        case 1: return "11101110111011101000";
        default: return null;
        }
      } else if (ch.equals(" ")) {
        switch (row) {
        case 1: return "00000";
        default: return null;
        }         
      } else {  // Invalid Char
        switch (row) {
        case 1: return "11111111000";
        default: return null;          
        }
        /*
        switch (row) {
        case 1: return "";
        default: return null;          
        }
        */
      }

    
  }
}