import java.applet.*; import java.awt.*; import java.awt.event.*; import java.text.*; import java.util.*; public class blindtouch extends Applet implements KeyListener,ActionListener{ Button bs = new Button("start"); Button bc = new Button("clear"); Panel pn = new Panel(); Panel ps = new Panel(); Panel px = new Panel(); TextArea ta = new TextArea(3,60); Label m1 = new Label(""); Label m2 = new Label(""); Label m3 = new Label(""); Label m4 = new Label("開始は「start」を押してください。"); long ts = 0 ; long te = 0 ; long tt = 0 ; double l = 0 ; double n = 0 ; String s = ""; String str= ""; Color c; Image img,wimg; Graphics w,wx,wg; DecimalFormat f = new DecimalFormat("0.00"); String t [][] = {{"1","!","010","000","pi"," "}, {"2","2","040","000","ma"," "}, {"3","#","070","000","wh"," "}, {"4","$","100","000","bl"," "}, {"5","%","130","000","bl"," "}, {"6","&","160","000","cy"," "}, {"7","'","190","000","cy"," "}, {"8","(","220","000","gr"," "}, {"9",")","250","000","ye"," "}, {"0","0","280","000","or"," "}, {"-","=","310","000","or"," "}, {"^","~","340","000","or"," "}, // {" "," ","370","000","or"," "}, {"Q","q","025","030","pi"," "}, {"W","w","055","030","ma"," "}, {"E","e","085","030","wh"," "}, {"R","r","115","030","bl"," "}, {"T","t","145","030","bl"," "}, {"Y","y","175","030","cy"," "}, {"U","u","205","030","cy"," "}, {"I","i","235","030","gr"," "}, {"O","o","265","030","ye"," "}, {"P","p","295","030","or"," "}, {"@","`","325","030","or"," "}, {"[","{","355","030","or"," "}, {"A","a","040","060","pi"," "}, {"S","s","070","060","ma"," "}, {"D","d","100","060","wh"," "}, {"F","f","130","060","bl","1"}, {"G","g","160","060","bl"," "}, {"H","h","190","060","cy"," "}, {"J","j","220","060","cy","1"}, {"K","k","250","060","gr"," "}, {"L","l","280","060","ye"," "}, {";","+","310","060","or"," "}, {":","*","340","060","or"," "}, {"Z","z","055","090","pi"," "}, {"X","x","085","090","ma"," "}, {"C","c","115","090","wh"," "}, {"V","v","145","090","bl"," "}, {"B","b","175","090","bl"," "}, {"N","n","205","090","cy"," "}, {"M","m","235","090","cy"," "}, {",","<","265","090","gr"," "}, {".",">","295","090","ye"," "}, {"/","?","325","090","or"," "}}; public void init() { pn.setLayout(new GridLayout(1,1)); pn.add(ta); px.setLayout(new GridLayout(1,2)); px.add(bs); px.add(bc); ps.setLayout(new GridLayout(5,1)); ps.add(m1); ps.add(m2); ps.add(m3); ps.add(m4); ps.add(px); setLayout(new BorderLayout()); add ("South",ps); add ("North",pn); Dimension w = getSize(); int dw = w.width; int dh = w.height; img = createImage(dw,dh); wimg = createImage(dw,dh); wg = wimg.getGraphics(); wx = img.getGraphics(); bs.addActionListener(this); bc.addActionListener(this); addKeyListener(this); requestFocus(); Date d =new Date(); ts = d.getTime(); key();edt();repaint(); } public void paint(Graphics g) { g.drawImage(wimg,0,80,this) ; } public void key(){ setBackground(Color.lightGray); for (int i=0;i