JTextField field = new JTextField(20);
field.setText("Button 1");
That is because you are referring to the field object you created that only has the scope of the ActionListener.
Also,...
Type: Posts; User: javapenguin
JTextField field = new JTextField(20);
field.setText("Button 1");
That is because you are referring to the field object you created that only has the scope of the ActionListener.
Also,...
Put this line before your actionListeners are coded.
JTextField field = new JTextField(20);
Right now field is null when it's going into them.