如何在Jbutton中修复ActionListener

时间:2019-05-29 23:52:27

标签: java

即使我有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); 

0 个答案:

没有答案