package hamming.Views;

import javax.swing.*;

public class HammingView extends JFrame {

    public HammingView() {
        super("TP3 - Hamming Calculator");
        initMenu();
        setSize(400, 200);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
    }

    private void initMenu() {
        JMenuBar menuBar = new JMenuBar();
        JMenu menu = new JMenu("Menu");

        JMenuItem genererItem = new JMenuItem("Générer Hamming");
        genererItem.addActionListener(e -> new HammingGenerationView());

        JMenuItem verifierItem = new JMenuItem("Vérifier Message");
        verifierItem.addActionListener(e -> new HammingVerificationView());
        
        JMenuItem quitterItem = new JMenuItem("Quitter");
        quitterItem.addActionListener(e -> System.exit(0));

        menu.add(genererItem);
        menu.add(verifierItem);
        menu.add(quitterItem);
        menuBar.add(menu);

        setJMenuBar(menuBar);
    }
}
