I am trying to get the text entered from jtf3 and jtf4 to show in the Message Dialog str1 and str2. Error states that the symbol fot str1 and str2 cannot be found. Please advice.
class ChuaWeiheng extends JFrame
{
private final JLabel jl, jl1, jl2, jl3, jlimage;
private final JTextField jtf, jtf1, jtf2, jtf3, jtf4;
private final Icon ic;
jtf3 = new JTextField(30);
add(jtf3);
jtf4 = new JTextField(30);
add(jtf4);
Comments c = new Comments();
jtf3.addActionListener(c);
jtf4.addActionListener(c);
}
private class Comments implements ActionListener
{
@Override
public void actionPerformed (ActionEvent e)
{
String str = "Summary of your changes";
String str1 = jtf3.getText();
String str2 = jtf4.getText();
if(e.getSource() == jtf3)
str1 = str1.setText(jtf3.getText());
if(e.getSource() == jtf4)
str2 = str1.setText(jtf4.getText());
JOptionPane.showMessageDialog (null, str, str1, str2, "My suggestion to the course", JOptionPane.ERROR_MESSAGE);
}
}
}