Can't find root of NullPointerException
Need a second pair of eyes to check this over, It's only partially complete, I havn't implemented the main functionality yet, but it should be reading the label from a button and sending it to a textfield.
import java.awt.*;
public class FileName extends java.applet.Applet
{
final int MAX_FILENAME = 12;
final int MAX_EXTENSION = 3;
Panel ip;
TextField input;
TextField output;
StringBuffer currentinput;
char currentchar;
public void init()
{
setBackground(Color.white);
input = new TextField(20);
input.setEditable(false);
output = new TextField(25);
output.setEditable(false);
Label filename = new Label("Filename:");
add(filename);
add(input);
Label result = new Label("Result:");
add(result);
add(output);
ip = new Panel();
ip.setLayout(new GridLayout(5,8,6,6));
for (char input=97; input < 123; input++)
{
Character c = new Character(input);
ip.add(new Button(c.toString()));
}
for (char input=48; input <= 57; input++)
{
Character c = new Character(input);
ip.add(new Button(c.toString()));
}
ip.add(new Button("."));
add(ip);
}
public boolean action(Event evt, Object arg)
{
String label = (String) arg;
if (evt.target instanceof Button)
{
currentchar = label.charAt(0);
currentinput.append(currentchar);
input.setText(currentinput.toString());
return true;
}
return true;
}
}
Apparently the "NPE" is in this line: "currentinput.append(currentchar);"

