Package ringdb.ui.menu

Source Code of ringdb.ui.menu.NewRingerMenuItem

package ringdb.ui.menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

import ringdb.database.Database;
import ringdb.ui.MainWindow;
import ringdb.ui.RingerScreen;

public class NewRingerMenuItem extends JMenuItem implements ActionListener {

  /** Version ID */
    private static final long serialVersionUID = -3954513406715680472L;
   
    /** Logger */
    private static Logger s_Logger = Logger.getLogger(Database.class.getPackage().getName());
   
    private MainWindow m_MainWindow;
   
    public NewRingerMenuItem(final MainWindow pr_MainWindow) {
      super("Ringer");
      addActionListener(this);
      setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK));
      m_MainWindow = pr_MainWindow;
    }

  @Override
    public void actionPerformed(final ActionEvent pr_Event) {
    RingerScreen screen = new RingerScreen(m_MainWindow);
    screen.setVisible(true);
    try {
      screen.setSelected(true);
    } catch (PropertyVetoException e) {
      s_Logger.log(Level.SEVERE, "Unable to open Ringer screen.", e);
    }
    m_MainWindow.addFrame(screen);   
    }

}
TOP

Related Classes of ringdb.ui.menu.NewRingerMenuItem

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.