Package com.fiveht.tick.ui.tray

Source Code of com.fiveht.tick.ui.tray.ExitMenuItem

/*
* Copyright (C) 2012 FiveHT Media Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package com.fiveht.tick.ui.tray;

import com.fiveht.tick.ui.Frame;
import com.fiveht.tick.ui.event.ExitEvent;
import java.awt.HeadlessException;
import java.awt.MenuItem;
import java.awt.MenuShortcut;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

/**
*
* @author Nathan Crause
*/
public class ExitMenuItem extends MenuItem implements ActionListener {
   
    private Frame frame;

    public ExitMenuItem(Frame view) throws HeadlessException {
        super("Exit");
       
        this.frame = view;
       
        init();
    }
   
    private void init() {
        setShortcut(new MenuShortcut(KeyEvent.VK_X));
        addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        frame.getView().fireExit(new ExitEvent(this));
    }
   
}
TOP

Related Classes of com.fiveht.tick.ui.tray.ExitMenuItem

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.