Package gui

Source Code of gui.MenuBarGUI

package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.Box;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import misc.GU;

import com.jgoodies.looks.plastic.PlasticTheme;
import com.jgoodies.looks.plastic.theme.Silver;
import com.jgoodies.looks.plastic.theme.ExperienceBlue;
import com.jgoodies.looks.plastic.theme.*;


/**
* Barre de menu.
*
* @author Ait Elhaj Brahim
*/
public class MenuBarGUI extends JMenuBar {

   
    /**
     * Renvoie la barre de menu par défaut.
     *
     * @param t La fenête <code>Ntp</code> à laquelle on souhaite associé la barre de menu
     */
    public MenuBarGUI(final Ntp t) {
        JMenu menu;
        JMenuItem menuItem;

        menu = new JMenu("Fichier");
        menuItem = new JMenuItem("Quitter", KeyEvent.VK_Q);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                t.dispose();
                System.exit(0);
            }
        });
        menu.add(menuItem);
        add(menu);
       
       
        /* Ajout possibilité de changer de Look&Feel */
        menu = new JMenu("Look&Feel");
        menuItem = new JMenuItem("Experience Blue",KeyEvent.VK_C);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              GU.changeUiSkin(new ExperienceBlue(),t);
            }
        });
        menu.add(menuItem);
       
       
        menuItem = new JMenuItem("Silver",KeyEvent.VK_S);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              GU.changeUiSkin(new Silver(),t);
            }
        });
        menu.add(menuItem);
       
        menuItem = new JMenuItem("Sky Bluer",KeyEvent.VK_K);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
              GU.changeUiSkin(new SkyBluer(),t);
            }
        });
        menu.add(menuItem);
       
        /*menu = new JMenu("Edition");
        menuItem = new JMenuItem("Annuler", KeyEvent.VK_C);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                System.out.println("annuler");
            }
        });*/
       
        //menu.addSeparator();
       
       
        add(menu);

       // PopupManager pm = new PopupManager(null, fs.getModel());
        //menu = pm.getDisplay();
        //menu.add(LookAndFeels.getLookAndFeelsMenu(fs));
        //add(menu);

        add(Box.createHorizontalGlue());
        menu = new JMenu("Aide");
       /* menuItem = new JMenuItem("Sommaire", KeyEvent.VK_S);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                System.out.println("sommaire");
            }
        });
        menu.add(menuItem);
        menu.addSeparator();*/
        menuItem = new JMenuItem("A propos", KeyEvent.VK_A);
        menuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                new About(t);
            }
        });
        menu.add(menuItem);
        add(menu);
    }
 
}
TOP

Related Classes of gui.MenuBarGUI

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.