java中的这个小代码给了我4个错误。我不明白他们的意思。请帮我。
class Frames extends Frame implements ActionListener {
Frames() {
JFrame jf = new JFrame("Welcome");
Container c = jf.getContentPane();
JPanel jp = new JPanel();
c.add(jp);
JLabel jl = new JLabel("Please enter your name");
jp.add(jl);
JTextField jtf = new JTextField(30);
jp.add(jtf);
JButton jb = new JButton("Submit");
jp.add(jb);
jb.addActionListener(this);
jl.setForeground(Color.white);
jp.setBackground(Color.black);
jf.setBounds(200, 200, 400, 400);
jf.setVisible(true);
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
public void actionPerformed(ActionEvent ae) {
JOptionPane.showMessageDialog(frame, "Hello");
}
}
public static void main (String[] args) {
Frames f = new Frames();
}
}