You’re using the AWT-button with your import java.awt.Button;, that’s why you can use the method public void addActionListener(ActionListener l).Replace your import to import javafx.scene.control.Button;将最前面的导入java.awt.Button 改为import javafx.scene.contr