/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package menuu;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Menuu {
public static void main(String[] args) {
/**** creation fenetre principale ****/
JFrame fenetre = new JFrame("HELLO WORLD");
fenetre.setSize(400, 300);
JFrame f2 = new JFrame();
f2.setSize(400, 300);
JMenuBar menuBar = new JMenuBar();
JMenu file = new JMenu("file");
JMenu edit = new JMenu("Edit");
JMenu help = new JMenu("help");
menuBar.add(file);
menuBar.add(edit);
menuBar.add(help);
JMenuItem New = new JMenuItem("New");
JMenuItem exit = new JMenuItem("Exit");
file.add(New);
file.addSeparator();
file.add(exit);
fenetre.setJMenuBar(menuBar);
New.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
f2.setVisible(true);
}
});
fenetre.setVisible(true);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);