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
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
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"));
}}
text1 是输入M个数字的!!!
我的意思就是,对M个数进行N的组合!!!
{前記得空上一格