I'm trying to write a program in which there are two buttons on a JFrame, with different actions for clicking them. But when I run my program, there is only one button, a "no" button when I want a yes and no button. My code:
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JFrame;
public class YesNoButton extends JButton{
  private static final int HEIGHT = 400;
  private static final int WIDTH = 400;
  public static void main(String[] args){
    JFrame jf = new JFrame();
    JButton yesButton = new JButton("YES");
    JButton noButton = new JButton("NO");
    jf.add(yesButton);
    jf.add(noButton);
    class PushListener implements ActionListener{
      public void actionPerformed(ActionEvent e){
        if (e.getSource() == yesButton) {
          System.out.println("YOU CLICKED YES");
        } else if (e.getSource() == noButton) {
          System.out.println("YOU CLICKED NO");
        }
      }
    }
    ActionListener listen = new PushListener();
    noButton.addActionListener(listen);
    yesButton.addActionListener(listen);
    jf.setSize(WIDTH,HEIGHT);
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.setVisible(true);
  }
}
I want a "yes" and "no" button.