E:\>javac love.java
love.java:3: cannot resolve symbol
symbol  : class TextListener
location: class love
public class love extends Applet implements TextListener{
                                            ^
love.java:15: cannot resolve symbol
symbol  : class TextEvent
location: class love
public void textValueChanged(TextEvent e){
                             ^
love.java:29: cannot resolve symbol
symbol  : class TextEvent
location: class love
public void textValueChanged(TextEvent e){
                             ^
love.java:12: addTextListener(java.awt.event.TextListener) in java.awt.TextComp
nent cannot be applied to (love)
text1.addTextListener(this);
     ^
love.java:13: addTextListener(java.awt.event.TextListener) in java.awt.TextComp
nent cannot be applied to (love)
text2.addTextListener(this);
     ^
love.java:18: cannot resolve symbol
symbol  : variable StringTokenizer
location: class love
StringTokenizer.fenxi=new StringTokenizer(s,",'\n'");
^
love.java:18: cannot resolve symbol
symbol  : class StringTokenizer
location: class love
StringTokenizer.fenxi=new StringTokenizer(s,",'\n'");
                          ^
love.java:19: cannot resolve symbol
symbol  : variable fenxi
location: class love
int n=fenxi.countToken();
      ^
love.java:21: cannot resolve symbol
symbol  : variable i
location: class love
for(i=0;i<=n-1;i++)
    ^
love.java:21: cannot resolve symbol
symbol  : variable i
location: class love
for(i=0;i<=n-1;i++)
        ^
love.java:21: cannot resolve symbol
symbol  : variable i
location: class love
for(i=0;i<=n-1;i++)
               ^
love.java:22: cannot resolve symbol
symbol  : variable fenxi
location: class love
{String temp=fenxi.nextToken();
             ^
love.java:23: cannot resolve symbol
symbol  : variable i
location: class love
a[i]=temp;
  ^
love.java:33: cannot resolve symbol
symbol  : variable a
location: class love
String cc=a[i];
          ^
love.java:33: cannot resolve symbol
symbol  : variable i
location: class love
String cc=a[i];
            ^
love.java:34: compute(int[],int) in love cannot be applied to (int,int)
compute(num,0);
^
love.java:41: cannot resolve symbol
symbol  : variable cc
location: class love
    for (int i = maxUnUsed; i < cc.length; ++i) {
                                ^
love.java:52: cannot resolve symbol
symbol  : variable cc
location: class love
      text3.append(cc[result[i]]+((i!=result.length-1)?",":"\n"));
                   ^
18 errors

解决方案 »

  1.   

    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.StringTokenizer;
    public class love extends Applet implements TextListener{
    TextArea text1,text2,text3;public void init(){
    text1=new TextArea(8,23);
    text2=new TextArea(20,1);
    text3=new TextArea(9,25);
    add(text1);add(text2);add(text3);
    text3.setEditable(false);
    text1.addTextListener(this);
    text2.addTextListener(this);
    }
    public void textValueChanged(TextEvent e){
    if(e.getSource()==text1)
    {String s=text1.getText();
    StringTokenizer fenxi=new StringTokenizer(s,",'\n'");
    int n=fenxi.countTokens();
    String a[]=new String[n];
    for(int i=0;i<=n-1;i++)
    {String temp=fenxi.nextToken();
    a[i]=temp;
    }}} /*
    public void textValueChanged(TextEvent e){
    if(e.getSource==text2)
    {String number=text2.getText();
    int num=Integer.parseInt(number);
    String cc=a[i];
    compute(num,0);
    }
    }
    */
     public  void compute(int[] result, int current) {
        int maxUnUsed = (current == 0) ? 0 : result[current - 1] + 1;
        for (int i = maxUnUsed; i < cc.length; ++i) {
          result[current] = i;
          if (current != result.length - 1)
            compute(result,current + 1);
          else
            display(result);
        }
      }
      public void display(int[] result){
      text3.setText(null);
        for(int i = 0; i < result.length; ++i)
          text3.append(cc[result[i]]+((i!=result.length-1)?",":"\n"));
      }}
      

  2.   

    我没有看你的程序要表达什么意思,我只是找语法帮你改一下,方法:textValueChanged(TextEvent e)你写了2个,我把一个注释掉了,注释掉的这个的语法问题我没有改,另外compute中的cc和display中的cc使啥玩意?我不知道多疑没有改
      

  3.   

    我text2 是用来输入N的!◎!!
     text1  是输入M个数字的!!!
    我的意思就是,对M个数进行N的组合!!!
      

  4.   

    public class love extends Applet implements TextListener {
    {前記得空上一格