Hi daniwebbers,
I am a newbie learning java and keep getting a "cannot find symbol" error when I try to compile my program. I've tried searching but I don't really know what search terms I should be using in this case. Can anyone see the problem?
import javax.swing.*;
import java.awt.event.*;
class menuFrame extends JFrame implements ActionListener{
public static void main(String[] args){
new menuFrame();
}
public menuFrame(){
JPanel menuPanel = new JPanel();
menuPanel.setLayout(null);
JLabel lblName = new JLabel("Name: ");
lblName.setBounds(30, 20, 100, 20);
JTextField txtName = new JTextField(15);
txtName.setBounds(80,20,150,20);
JButton btnStart = new JButton("Start");
btnStart.setBounds(90,60,100,20);
menuPanel.add(lblName);
menuPanel.add(txtName);
menuPanel.add(btnStart);
setDefaultProperties();
}
public void setDefaultProperties(){
this.setTitle("Hello World!");
this.setSize(300,200);
this.setVisible(true);
this.setLocationRelativeTo(null);
this.add(menuPanel);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == btnStart)
btnStart.setText("lol");
}
}
Thanks in advance!