OK... I'm seriously stuck. I can't seem to figure out how to convert an int to a
String. I'm using the toString() method but can't seem to get it to work. What am I doing wrong???
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
public class DoubleInteger extends
Applet implements ActionListener
{
TextField info = new TextField(20);
Label answer = new Label("The Answer");
Button pressMe = new Button("Press Me");
int dInfo;
int doubleInfo;
String finalAnswer;
public void init()
{
add(info);
add(pressMe);
pressMe.addActionListener(this);
add(answer);
invalidate();
validate();
}
public void actionPerformed(ActionEvent e)
{
String x = info.getText();
int anInt = Integer.parseInt(x);
int theAnswer = anInt * 2;
System.out.println(theAnswer);
finalAnswer = theAnswer.toString();
answer.setText(finalAnswer);
}
}