即使我有ActionListener,我的Jbutton也无法正常工作。
代码示例
btnNewButton = new JButton("Add Customers");
add(btnNewButton);
btnNewButton.addActionListener(this);
JLabel lblNewLabel = new JLabel("Enter name");
btnNewButton.addActionListener(this);
lblNewLabel.setBackground(Color.ORANGE);
panel.add(lblNewLabel);
//not working for me to add customer
btnNewButton.addActionListener(this);