因为教师的需要,要做一个五笔程序,都在快完成的时候给卡住了,
    都找不出问题所在,请大家帮一下手,
  在线等             
  “问题是每当"有窗口"在 JLabel 上面的红色字就会消失,
不知是不是 repaint() 不恬时刷新的结果?
以下是图片代码是import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.awt.color.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.awt.geom.*;
import javax.swing.JOptionPane.*;public class test extends JFrame implements CaretListener,MouseListener{JTabbedPane ta =new JTabbedPane();//标按钮
JTextArea  textAreaObjor[] =new JTextArea[4];//标按钮的下的大组件
JPanel jp =new JPanel();//第一个面板
JPanel jplost =new JPanel();//最后一个面板
JTextField fieldOne,fieldTwo,fieldThree=null;//定义小文本框
RoundButton labelOne =new RoundButton();//定义图标
RoundButton labelTwo =new RoundButton();//定义图标
RoundButton labelThree =new RoundButton();//定义图标
char[] isrightOne,isrightTwo,isrightThree=null;
char[][]rightStringOne=new char[2][24];
char[][]rightStringTwo=new char[2][24];
char[][]rightStringThree=new char[2][25];
String ziOne,ziTwo,ziThree=null;public void test(){
this.setTitle("小草五笔教程");
Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); //取得屏幕的大小
setBounds(0,0,d.width,d.height-30); //设全屏
setResizable(true);//不可以改变窗口的大小jp.setLayout(new GridLayout(6,1));
jplost.setLayout(new BorderLayout());//设置布局管理器  fieldOne=new JTextField(new NumberDocument(24),null,27);
  fieldTwo=new JTextField(new NumberDocument(24),null,27);
  fieldThree=new JTextField(new NumberDocument(25),null,27);    ziOne="儿夕八用乃手斤竹广文方六门小米七戈丁西犬古石厂士";
   ziTwo="干雨寸五止早虫川车力甲四弓马刀九也耳尸心羽由贝几";
ziThree="王土大木工禾白月人金言立水火之目日口田山已子女又丝";
labelOne.zi=ziOne;//设绘制字体
labelTwo.zi=ziTwo;//设绘制字体
labelThree.zi=ziThree;//设绘制字体isrightOne = ziOne.toCharArray();//将字根变成CHAR[]数组
isrightTwo = ziTwo.toCharArray();//将字根变成CHAR[]数组
isrightThree = ziThree.toCharArray();//将字根变成CHAR[]数组for(int i=0;i<25;i++){
if(i<24){
    rightStringOne[0][i]=isrightOne[i];
    rightStringTwo[0][i]=isrightTwo[i];
}
     rightStringThree[0][i]=isrightThree[i];
}
for(int j=0;j<25;j++){
if(j<24){
rightStringOne[1][j]='t';
rightStringTwo[1][j]='t';
}
rightStringThree[1][j]='t';}for(int i=0;i<4;i++){
textAreaObjor[i]=new JTextArea();//生成大文档框
}
jp.add(labelOne);//添加到小容器令其平均分配
jp.add(fieldOne);//添加到小容器令其平均分配jp.add(labelTwo);//添加到小容器令其平均分配
jp.add(fieldTwo);//添加到小容器令其平均分配
jp.add(labelThree);//添加到小容器令其平均分配
jp.add(fieldThree);//添加到小容器令其平均分配jplost.add(textAreaObjor[0],BorderLayout.PAGE_START);//添加到大容器
jplost.add(jp,BorderLayout.CENTER);//添加到大容器labelOne.setFocusable(false);//设不可以得到焦点
labelTwo.setFocusable(false);//设不可以得到焦点
labelThree.setFocusable(false);//设不可以得到焦点  fieldOne.setRequestFocusEnabled(false);//只允许键盘输入焦,
  fieldTwo.setRequestFocusEnabled(false);//只允许键盘输入焦,
  fieldThree.setRequestFocusEnabled(false);//只允许键盘输入焦,fieldTwo.setFocusable(false);//设不可以得到焦点********************************文本框框设为不可得焦点小心
fieldThree.setFocusable(false);//设不可以得到焦点*****************************文本框框设为不可得焦点小心     fieldOne.addCaretListener(this);//增加播入附的接口
     fieldTwo.addCaretListener(this);//增加播入附的接口
     fieldThree.addCaretListener(this);//增加播入附的接口  fieldOne.addMouseListener(this);//增加鼠标接口
  fieldTwo.addMouseListener(this);//增加鼠标接口
  fieldThree.addMouseListener(this);//增加鼠标接口
  
   fieldOne.setFont(new Font("宋体",Font.BOLD,30));
   fieldTwo.setFont(new Font("宋体",Font.BOLD,30));
   fieldThree.setFont(new Font("宋体",Font.BOLD,30));
  
  textAreaObjor[0].setFont(new Font("宋体",Font.BOLD,16));//大文档框设字体
  textAreaObjor[0].setEditable(false);//将大文件框设置为不可编辑
  textAreaObjor[0].setFocusable(false);//将大文件框不可以得到焦点
  textAreaObjor[0].setBackground(new Color(255,255,208));fieldThree.addFocusListener(new FocusAdapter() {  //实现离开文本框5就清空,文本框1,和文本框3
public void focusLost(FocusEvent e) {
        fieldOne.setText(null);
        fieldOne.setEditable(true);
        fieldOne.requestFocusInWindow();
           fieldThree.setText(null);
           fieldTwo.setText(null);
          fieldTwo.setEditable(true);
         }
});
this.addWindowListener(new WindowAdapter()  {   //实现一开机就tfObjor[1]就得到焦点
          public void windowOpened(WindowEvent e){   
                 fieldOne.requestFocusInWindow();  
                 ta.setFocusable(false); 
          }   
  });  ta.addTab("口决包含打法" ,jplost);
//ta.addTab("口决第一个字的打法",textAreaObjor[1]);
//ta.addTab("一级简码",textAreaObjor[2]);
//ta.addTab("混合字打法",textAreaObjor[3]);rd();//实现TXT文件的读写//ta.setPreferredSize(new Dimension(800,600));
this.getContentPane().add(ta);
ta.validate();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
}//方法的//实现TXT文件的读写的方法//***********************************************************************以下是读取流
public void rd(){try{
BufferedReader in =new BufferedReader(new FileReader("test.txt"));
String str=new String();while((str=in.readLine())!=null){textAreaObjor[0].setLineWrap(true);//自动换行
     textAreaObjor[0].append(str+'\n');
}
in.close();
}
catch(IOException e){e.printStackTrace();}
}//rd方法
+++++++++++++++++++++++++++++++++++++++++++++++++++++=以下是

解决方案 »

  1.   

    public void caretUpdate(CaretEvent e){  //*********************************以下是插入附的接口实现JTextField temptf=(JTextField)e.getSource();        //if(temptf==fieldOne&&labelOne.已点击文本框 ==false){
            //labelOne.已点击文本框=true
    //}
    if((temptf==fieldOne) && (e.getDot()!=(fieldOne.getText().length()))){ //将光标移到最前
    fieldOne.setCaretPosition(fieldOne.getText().length());}else if((temptf==fieldTwo) && (e.getDot()!=(fieldTwo.getText().length()))){//将光标移到最前fieldTwo.setCaretPosition(fieldTwo.getText().length());
    }else if((temptf==fieldThree) && (e.getDot()!=(fieldThree.getText().length()))){//将光标移到最前fieldThree.setCaretPosition(fieldThree.getText().length());}
    if(e.getDot()==0){   //******************当光标等于零时,绘制方块
            
    if(temptf==fieldOne){ //****************************当光标在文本框1时
    labelOne.done=false;for(int i=0;i<ziOne.length();i++){
      if(是否有错字(rightStringOne,ziOne.length())){ //判断是否有错字
            全部设为真(rightStringOne,ziOne.length());//如果有就全部设为真
            }//if
    }//for
    labelOne.repaint();//重绘组件}//当光标在文本框fieldOne1上时else if(temptf==fieldTwo){ //**********************当光标在文本框2时
             labelTwo.done=false;for(int i=0;i<ziTwo.length();i++){
      if(是否有错字(rightStringTwo,ziTwo.length())){ //判断是否有错字
            全部设为真(rightStringTwo,ziTwo.length());//如果有就全部设为真
            }//if
    }//for
    labelTwo.repaint();
    }//当光标在文本框fieldTwo2上时
    else if(temptf==fieldThree){   //*****************************当光标在文本框3时
             labelThree.done=false;for(int i=0;i<ziThree.length();i++){
      if(是否有错字(rightStringThree,ziThree.length())){ //判断是否有错字
            全部设为真(rightStringThree,ziThree.length());//如果有就全部设为真
            }//if
    }//forlabelThree.repaint();
    }//当光标在文本框fieldThree上时} //**************************当光标等于零时,绘制方块//_______________________________________________________________________当光标大于等于1时,绘制方块else if(e.getDot()>=1){ //**************************当光标大于等于1时,绘制方块  if(temptf==fieldOne){ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||当光标大于等于1时,绘制方块
    labelOne.con =e.getDot();//将参数转给RoundButton类修改变量的值
    labelOne.done=true;//**************将参数转给RoundButton类表示可以绘方块
    //******************************************** //当插入附的长度大于>cahr[]的长度时if(e.getDot()<isrightOne.length){ //当插入附的长度大于<(一唯字体的数组)cahr[]的长度时《本IF是要来实现错字的记忆》String tempnow =fieldOne.getText();//得到文本框的长度
    String  tro =String.valueOf(isrightOne[e.getDot()-1]);//将文本框char[]转为String形式if(tempnow.endsWith(tro)){ //判断文本框的结尾是不是和char字附数组的字附相等;labelOne.crateChar(rightStringOne,ziOne.length()); //将参数输给RoundButton类,来构建一个数组 
      labelOne.无错别字=true;
      labelOne.得到相等的位=e.getDot();
    }else{//判断输入的字与char是否相等
      int ztemp=e.getDot()-1;
      rightStringOne[1][ztemp]='f';//将指定的字附设为假for(int i=ztemp+1;i<24;i++){ //当找到一个假之后,数组的以后位都全设为真            
    rightStringOne[1][i]='t';
    }
    labelOne.crateChar(rightStringOne,24); //将参数输给RoundButton类,来构建一个数组 
      labelOne.isfalse=true;//将参数输给RoundButton类,来决定是否《可绘错字》
    }//else}//以下***********************************当插入附的长度,与cahr[]的长度相等时else if(e.getDot()==isrightOne.length){//___________________________________当插入附的长度与cahr[]的长度相等时((焦点至了尾处))
    String tempnow =fieldOne.getText();//_______________________________________得到文本框的长度
    String  tro =String.valueOf(isrightOne[e.getDot()-1]);//______________________将文本框char[]转为String形式
            
         if(tempnow.endsWith(tro)){ //__________________________________判断是文本框的结尾是不是和char字附数组的字附相等;
            
      labelOne.crateChar(rightStringOne,ziOne.length()); //将参数输给RoundButton类,来构建一个数组 
      labelOne.无错别字=true;
      labelOne.得到相等的位=e.getDot();}//if
            
            else{   int ztemp=e.getDot()-1;
      rightStringOne[1][ztemp]='f';//将指定的字附设为假
    labelOne.crateChar(rightStringOne,ziOne.length()); //将参数输给RoundButton类,来构建一个数组 
      labelOne.isfalse=true;//将参数输给RoundButton类,来决定是否《可绘错字》}//elsefieldTwo.setFocusable(true);//当插入附到了尾处,设JTextField2得到焦点********************************文本框框设为不可得((焦点小心))
    fieldTwo.requestFocusInWindow();//JTextField2得到焦点
    fieldOne.setFocusable(false);//********************************文本框框设为不可得((焦点小心))}//以上结束当插入附的长度,与cahr[]的长度************************************************************相等时//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||以下是插入附的长度大于cahr[]的长度时labelOne.repaint();}//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||当光标大于等于1时,绘制方块//___________________________________以上都是光标在fieldOne上的_____________________________________________________else if(temptf==fieldTwo){//判断插入附是不是在fieldTwo上
    //实现重绘写错字的方法(e,fieldTwo,labelTwo);//这个要来测试***********************************
    labelTwo.con =e.getDot();
    labelTwo.done=true;
    绘全(e,fieldTwo,labelTwo,isrightTwo,rightStringTwo,isrightTwo.length);//完成绘制的全过程labelTwo.repaint();}else if(temptf==fieldThree){
            labelThree.xulength=25;
            labelThree.con =e.getDot();
    labelThree.done=true;绘全(e,fieldThree,labelThree,isrightThree,rightStringThree,isrightThree.length);//完成绘制的全过程labelThree.repaint();}//fieldThree temptf==fieldThree
    }}//*********************************以上是插入附的接口实现
    //******************************************************************以下是鼠标的接口
      

  2.   

    public void mouseClicked(MouseEvent e) {}//  鼠标按键在组件上单击(按下并释放)时调用。
    public void mouseEntered(MouseEvent e){}//鼠标进入到组件上时调用。
    public void mouseExited(MouseEvent e){}//鼠标离开组件时调用。
    public void mouseReleased(MouseEvent e){}//鼠标按钮在组件上释放时调用。public void mousePressed(MouseEvent e){JTextField temptf=(JTextField)e.getSource();if(temptf==fieldOne && (fieldOne.getText().length())>=1){
        fieldOne.setCaretPosition( fieldOne.getText().length());
    }else if(temptf==fieldTwo && (fieldTwo.getText().length())>=1){
        fieldTwo.setCaretPosition(fieldTwo.getText().length());
    }
    else if(temptf==fieldThree && (fieldThree.getText().length())>=1){
           fieldThree.setCaretPosition(fieldThree.getText().length());
    }}//鼠标按键在组件上按下时调用。
    //******************************************************************以上是鼠标的接口public boolean 是否有错字(char lookzu[][],int zuno){//**看下数组有无一个字附是错误用于当e.getDot()==0时
      for(int i=0;i<zuno;i++){
             if(lookzu[1][i]=='f'){
            
              return true;
                  }   
    }return false;}//looksuzu()看下数组有无一个字附是错误public void 全部设为真(char lookzuzuno[][],int tempzuno){//用于当e.getDot()==0时当有一个错字就将全部设为真for(int i=0;i<tempzuno;i++){
       lookzuzuno[1][i]='t';}}//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||lookzeroSuzu()方法
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%绘全\\void 绘全(CaretEvent Z,JTextField 文本框对象,RoundButton 图标对象, char 一唯字数组[],char 二唯字数组[][],int 输数位){
        
      int carmath =Z.getDot();
      JTextField 光标现处对象 = (JTextField)Z.getSource();
       图标对象.xulength=输数位;
    图标对象.con =carmath;//将参数转给RoundButton类修改变量的值
    图标对象.done=true;//**************将参数转给RoundButton类表示可以绘方块
    //******************************************** //当插入附的长度大于>cahr[]的长度时if(carmath<输数位){ //当插入附的长度大于<(一唯字体的数组)cahr[]的长度时《本IF是要来实现错字的记忆》String tempnow =文本框对象.getText();//得到文本框的长度
    String  tro =String.valueOf(一唯字数组[carmath-1]);//将文本框char[]转为String形式if(tempnow.endsWith(tro)){ //判断文本框的结尾是不是和char字附数组的字附相等;
    System.out.println("ojber"+carmath+"  位数"+输数位);  图标对象.crateChar(二唯字数组,输数位); //将参数输给RoundButton类,来构建一个数组 
      图标对象.无错别字=true;
      图标对象.得到相等的位=Z.getDot();}else{//判断输入的字与char是否相等
      int ztemp=carmath-1;
      二唯字数组[1][ztemp]='f';//将指定的字附设为假for(int i=ztemp+1;i<输数位;i++){ //当找到一个假之后,数组的以后位都全设为真            
    二唯字数组[1][i]='t';
    }
    图标对象.crateChar(二唯字数组,输数位); //将参数输给RoundButton类,来构建一个数组 
      图标对象.isfalse=true;//将参数输给RoundButton类,来决定是否《可绘错字》
    }//else}//以下***********************************当插入附的长度,与cahr[]的长度相等时else if(carmath== 输数位){//___________________________________当插入附的长度与cahr[]的长度相等时((焦点至了
    String tempnow =文本框对象.getText();//_______________________________________得到文本框的长度
    String  tro =String.valueOf(一唯字数组[carmath-1]);//______________________将文本框char[]转为String形式
            
         if(tempnow.endsWith(tro)){ //__________________________________判断是文本框的结尾是不是和char字附数组的字附相等;
          
      图标对象.crateChar(二唯字数组,输数位); //将参数输给RoundButton类,来构建一个数组 
      图标对象.无错别字=true;
    图标对象.得到相等的位=carmath;}//if
            
            else{   int ztemp=carmath-1;
      二唯字数组[1][ztemp]='f';//将指定的字附设为假
    图标对象.crateChar(二唯字数组,输数位); //将参数输给RoundButton类,来构建一个数组 
      图标对象.isfalse=true;//将参数输给RoundButton类,来决定是否《可绘错字》}//elseif(文本框对象 == fieldTwo){
            
    fieldThree.setFocusable(true);//当插入附到了尾处,设JTextField2得到焦点********************************文本框框设为不可得((焦点小心))
    fieldThree.requestFocusInWindow();//JTextField2得到焦点
    fieldTwo.setFocusable(false);//********************************文本框框设为不可得((焦点小心))
            
    }//当现是插入附的对象在fieldOne上else if(文本框对象 == fieldThree){
        fieldOne.setFocusable(true);
                    fieldOne.requestFocusInWindow();
            
    }////当现是插入附的对象在fieldThree上}//以上结束当插入附的长度,与cahr[]的长度************************************************************相等时
    }//___________________________________以上都是光标在fieldOne上的_____________________________________________________
    public void setLookAndFeel(){   
              try{   
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");   
                 //UIManager.setLookAndFeel("javax.swing.plaf.mac.MacLookAndFeel");   
                  SwingUtilities.updateComponentTreeUI(this);   
              }catch(Exception   ex){   
                  System.out.print("Failed!");   
              }   
          }   public static void main(String arg[]){
      test te=new test();
    te.setLookAndFeel();
    te.test();}
    }
      

  3.   

    class NumberDocument extends PlainDocument {   
          int len;   
          public NumberDocument(int length)   {   
              len = length;   
          }   
          public void insertString(int offs, String str, AttributeSet a) throws BadLocationException{   
              char[] source = str.toCharArray();   
                  if(source.length==1 && getLength()<len){   
                           
                    super.insertString(offs,new String(source,0,1),a); 
                  }   
                  else{   
        super.insertString(offs,null,a);
                  }   
          
          }    }
    +++++++++++++++++++++++++++++++++++++++++++++++++++++=以下是第二个类
    import java.awt.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import java.net.*;public class RoundButton extends JLabel{
    boolean done=false;
      int con =1;//判断光标的位数来改变方框的位置
    String zi =" ";
    boolean isfalse=false;
      int xulength =24;
       char[][] newchar;
      int 得到相等的位 =10;//是不是和char字附数组的字附=相等时才用”用于全部重绘
    boolean 无错别字=false;//用于当主类if(tempnow.endsWith(tro))相等时用的
    //boolean 已点击文本框=false;    public RoundButton(){
    newchar=new char[2][25];
        }   public void paintComponent(Graphics g){
              Font f = new Font("宋体",Font.BOLD,30);
          g.setFont(f);
           FontMetrics fm = g.getFontMetrics();
         
        if(done){
           
          g.setColor(new Color(255,255,255));
          g.fillRect(0,0, getSize().width-1, getSize().width-1);
      if(con!=xulength){                                      //要小心这个xulength变量
         g.setColor(new Color(196,232,252));
        g.fillRect(((con*fm.stringWidth("国"))),5,fm.stringWidth("国"),fm.getHeight());
       }
          g.setColor(Color.black); 
        g.drawString(zi,0,32);
        
       }
      
    else if(done==false){   g.setColor(new Color(255,255,255)); 
       g.fillRect(0, 0,getSize().width-1, getSize().height-1);
       g.setColor(new Color(196,232,252));
       g.fillRect(1,5,fm.stringWidth("国"),fm.getHeight());
          g.setColor(Color.black); 
        g.drawString(zi,0,32);
    }//************************************************************判断是否有错别字   if(isfalse){for(int i=0;i<xulength;i++){  //如果是文本框3就要改,xulength=24
       if(newchar[1][i]=='f'){
       g.setColor(Color.red);
      g.drawString((String.valueOf(newchar[0][i])),(fm.stringWidth("国")*i),32);}//if}//for
    isfalse=false;
    }//isfalse************************************************************判断是否有错别字
    if(无错别字){    //这个是为了实现 “判断文本框的结尾和char字附数组的字附=相等时才用”只要全部重绘就行
                     //主类要先给int 得到相等的位,给一个数,还要输入一个数组,还要做的是int 无错别字要=true;
    for(int i=0;i<得到相等的位;i++){  if(newchar[1][i]=='f'){
       g.setColor(Color.red);
      g.drawString((String.valueOf(newchar[0][i])),(fm.stringWidth("国")*i),32);}//if}//for_2无错别字=false;}//if无错别字  super.paintComponent(g);
      }//**************************************************************以下类完成数组的自制public void crateChar(char createTemp[][],int xunow){   for(int i =0;i<xunow;i++){
           for(int j=0;j<2;j++){
          newchar[j][i]=createTemp[j][i];
    }//for
    }//for}//crateChar}
      

  4.   

    color=有高手吗可以请帮下手啦!!!!!!!!!!!!!![CC99FF][/color]
      

  5.   

    最后简化了一下,请大家帮一下手import java.awt.*; 
    import javax.swing.*; 
    import java.awt.event.*; 
    import java.io.*; 
    import java.awt.color.*; 
    import javax.swing.text.*; 
    import javax.swing.event.*; 
    import java.awt.geom.*; 
    import javax.swing.JOptionPane.*; public class nubeclass extends JFrame implements CaretListener,MouseListener{ JTabbedPane ta =new JTabbedPane();//标按钮 
    JLabel 教程图片对象 =new JLabel("图片现在不加,");
    JPanel jp =new JPanel();//第一个面板 
    JPanel jplost =new JPanel();//最后一个面板 
    JTextField 输入框对象[] =new JTextField[3];
    RoundButton 给出文字对象[] =new RoundButton[3];//定义图标 char[] isrightOne,isrightTwo,isrightThree=null; 
    char[][]rightStringOne=new char[2][24]; 
    char[][]rightStringTwo=new char[2][24]; 
    char[][]rightStringThree=new char[2][25]; 
    String 文字附串对象[] =new String[3];public void nubeclass(){ 
    this.setTitle("小草五笔教程"); 
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); //取得屏幕的大小 
    setBounds(0,0,d.width,d.height-30); //设全屏 
    setResizable(true);//不可以改变窗口的大小 jp.setLayout(new GridLayout(6,1)); 
    jplost.setLayout(new BorderLayout());//设置布局管理器 文字附串对象[0]="儿夕八用乃手斤竹广文方六门小米七戈丁西犬古石厂士"; 
    文字附串对象[1]="干雨寸五止早虫川车力甲四弓马刀九也耳尸心羽由贝几"; 
    文字附串对象[2]="王土大木工禾白月人金言立水火之目日口田山已子女又丝";  for(int i=0;i<3;i++){
     给出文字对象[i]=new RoundButton();
     
     输入框对象[i] =new JTextField(new NumberDocument(24),null,27); 
     
     给出文字对象[i].zi=文字附串对象[i];//设绘制字体 
     jp.add(给出文字对象[i]);//添加到小容器令其平均分配 
     jp.add(输入框对象[i]);//添加到小容器令其平均分配 
     给出文字对象[i].setFocusable(false);//设不可以得到焦点 
     输入框对象[i].setRequestFocusEnabled(false);//只允许键盘输入焦, 
     输入框对象[i].addCaretListener(this);//增加播入附的接口 
     输入框对象[i].addMouseListener(this);//增加鼠标接口 
     输入框对象[i].setFont(new Font("宋体",Font.BOLD,30)); 
     }isrightOne = 文字附串对象[0].toCharArray();//将字根变成CHAR[]数组 
    isrightTwo = 文字附串对象[1].toCharArray();//将字根变成CHAR[]数组 
    isrightThree = 文字附串对象[2].toCharArray();//将字根变成CHAR[]数组 for(int i=0;i <25;i++){ 
    if(i <24){ 
        rightStringOne[0]=isrightOne; 
        rightStringTwo[0]=isrightTwo; 

        rightStringThree[0]=isrightThree; 

    for(int j=0;j <25;j++){ 
    if(j <24){ 
    rightStringOne[1][j]='t'; 
    rightStringTwo[1][j]='t'; 

    rightStringThree[1][j]='t'; } jplost.add(教程图片对象,BorderLayout.PAGE_START);//添加到大容器 
    jplost.add(jp,BorderLayout.CENTER);//添加到大容器 输入框对象[1].setFocusable(false);//设不可以得到焦点********************************文本框框设为不可得焦点小心 
    输入框对象[2].setFocusable(false);//设不可以得到焦点*****************************文本框框设为不可得焦点小心   教程图片对象.setText("以后才加说明方");
      教程图片对象.setFocusable(false);//将大文件框不可以得到焦点
        输入框对象[2].addFocusListener(new FocusAdapter() {  //实现离开文本框5就清空,文本框1,和文本框3 
    public void focusLost(FocusEvent e) { 
    输入框对象[0].setText(null); 
    输入框对象[0].setEditable(true); 
    输入框对象[0].requestFocusInWindow(); 
    输入框对象[2].setText(null); 
    输入框对象[1].setText(null); 
    输入框对象[1].setEditable(true); 
            } 
    }); 
    this.addWindowListener(new WindowAdapter()  {  //实现一开机就tfObjor[1]就得到焦点 
              public void windowOpened(WindowEvent e){  
               输入框对象[0].requestFocusInWindow();  
                    ta.setFocusable(false); 
              }  
      });  
    ta.addTab("口决包含打法" ,jplost); this.getContentPane().add(ta); 
    ta.validate(); 
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    show(); 
    }//方法的 //实现TXT文件的读写的方法 //***********************************************************************以下是读取流 
    public void caretUpdate(CaretEvent e){  //*********************************以下是插入附的接口实现 JTextField temptf=(JTextField)e.getSource(); 
    if((temptf==输入框对象[0]) && (e.getDot()!=(输入框对象[0].getText().length()))){ //将光标移到最前 
    输入框对象[0].setCaretPosition(输入框对象[0].getText().length()); } else if((temptf==输入框对象[1]) && (e.getDot()!=(输入框对象[1].getText().length()))){//将光标移到最前  输入框对象[1].setCaretPosition(输入框对象[1].getText().length()); 
    } else if((temptf==输入框对象[2]) && (e.getDot()!=(输入框对象[2].getText().length()))){//将光标移到最前  输入框对象[2].setCaretPosition(输入框对象[2].getText().length()); } 
    //输入框对象[0] 输入框对象[1] 输入框对象[2]      给出文字对象[0]给出文字对象[1]给出文字对象[2]
    //文字附串对象[0]文字附串对象[1]文字附串对象[2]
    if(e.getDot()==0){  //******************当光标等于零时,绘制方块 
            
    if(temptf==输入框对象[0]){ //****************************当光标在文本框1时 
    给出文字对象[0].done=false; for(int i=0;i <文字附串对象[0].length();i++){ 
      if(是否有错字(rightStringOne,文字附串对象[0].length())){ //判断是否有错字 
            全部设为真(rightStringOne,文字附串对象[0].length());//如果有就全部设为真 
            }//if 
    }//for 
    给出文字对象[0].repaint();//重绘组件 }//当光标在文本框fieldOne1上时 else if(temptf==输入框对象[1]){ //**********************当光标在文本框2时 
    给出文字对象[1].done=false; for(int i=0;i <文字附串对象[1].length();i++){ 
      if(是否有错字(rightStringTwo,文字附串对象[1].length())){ //判断是否有错字 
            全部设为真(rightStringTwo,文字附串对象[1].length());//如果有就全部设为真 
            }//if 
    }//for 
    给出文字对象[1].repaint(); 
    }//当光标在文本框fieldTwo2上时 //输入框对象[0] 输入框对象[1] 输入框对象[2]      给出文字对象[0]给出文字对象[1]给出文字对象[2]
    //文字附串对象[0]文字附串对象[1]文字附串对象[2]else if(temptf==输入框对象[2]){  //*****************************当光标在文本框3时 
    给出文字对象[2].done=false; for(int i=0;i <文字附串对象[2].length();i++){ 
      if(是否有错字(rightStringThree,文字附串对象[2].length())){ //判断是否有错字 
            全部设为真(rightStringThree,文字附串对象[2].length());//如果有就全部设为真 
            }//if 
    }//for 给出文字对象[2].repaint(); 
    }//当光标在文本框fieldThree上时 } //**************************当光标等于零时,绘制方块 //_______________________________________________________________________当光标大于等于1时,绘制方块 else if(e.getDot()>=1){ //**************************当光标大于等于1时,绘制方块 

      
       if(temptf==输入框对象[0]){//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||当光标大于等于1时,绘制方块 
       给出文字对象[0].con =e.getDot(); 
       给出文字对象[0].done=true; 
               绘全(e,输入框对象[0],给出文字对象[0],isrightOne,rightStringOne,isrightOne.length);//完成绘制的全过程 
       
               
               给出文字对象[0].repaint(); }//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||当光标大于等于1时,绘制方块 //___________________________________以上都是光标在fieldOne上的_____________________________________________________  
       
    else if(temptf==输入框对象[1]){//判断插入附是不是在fieldTwo上 
    //实现重绘写错字的方法(e,fieldTwo,labelTwo);//这个要来测试*********************************** 
    给出文字对象[1].con =e.getDot(); 
    给出文字对象[1].done=true; 
    绘全(e,输入框对象[1],给出文字对象[1],isrightTwo,rightStringTwo,isrightTwo.length);//完成绘制的全过程 给出文字对象[1].repaint(); } 
     
    else if(temptf==输入框对象[2]){ 
    给出文字对象[2].xulength=25; 
    给出文字对象[2].con =e.getDot(); 
    给出文字对象[2].done=true; 绘全(e,输入框对象[2],给出文字对象[2],isrightThree,rightStringThree,isrightThree.length);//完成绘制的全过程 给出文字对象[2].repaint(); }//fieldThree temptf==fieldThree 

    }//*********************************以上是插入附的接口实现 public void mouseClicked(MouseEvent e) { }//  鼠标按键在组件上单击(按下并释放)时调用。 
    public void mouseEntered(MouseEvent e){}//鼠标进入到组件上时调用。 
    public void mouseExited(MouseEvent e){}//鼠标离开组件时调用。 
    public void mouseReleased(MouseEvent e){ }//鼠标按钮在组件上释放时调用。 public void mousePressed(MouseEvent e){ JTextField temptf=(JTextField)e.getSource(); if(temptf==输入框对象[0] && (输入框对象[0].getText().length())>=1){ 
    输入框对象[0].setCaretPosition( 输入框对象[0].getText().length()); 
    } else if(temptf==输入框对象[1] && (输入框对象[1].getText().length())>=1){ 
    输入框对象[1].setCaretPosition(输入框对象[1].getText().length()); 

    else if(temptf==输入框对象[2] && (输入框对象[2].getText().length())>=1){ 
    输入框对象[2].setCaretPosition(输入框对象[2].getText().length()); 
    } }//鼠标按键在组件上按下时调用。 
    //******************************************************************以上是鼠标的接口