Debian Codegraph @

src/dr/app/bss/DefaultEditMenuFactory.java

raw symbols SCIP
1 /*
2 * DefaultEditMenuFactory.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.app.bss;
27
28 import java.awt.event.KeyEvent;
29
30 import javax.swing.JMenu;
31 import javax.swing.JMenuItem;
32 import javax.swing.KeyStroke;
33 import javax.swing.text.DefaultEditorKit;
34
35 import jam.framework.AbstractFrame;
36 import jam.framework.MenuBarFactory;
37 import jam.framework.MenuFactory;
38
39 /**
40 * @author Filip Bielejec
41 * @version $Id$
42 */
43 public class DefaultEditMenuFactory implements MenuFactory {
44
45 public DefaultEditMenuFactory() {
46 }// END: Constructor
47
48 @Override
49 public void populateMenu(JMenu menu, AbstractFrame frame) {
50
51 menu.setMnemonic('E');
52
53 JMenuItem item;
54
55 // Setup Cut
56 item = new JMenuItem(new DefaultEditorKit.CutAction());
57 item.setText("Cut");
58 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
59 MenuBarFactory.MENU_MASK));
60 menu.add(item);
61
62 // Setup Copy
63 item = new JMenuItem(new DefaultEditorKit.CopyAction());
64 item.setText("Copy");
65 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
66 MenuBarFactory.MENU_MASK));
67 menu.add(item);
68
69 // Setup Paste
70 item = new JMenuItem(new DefaultEditorKit.PasteAction());
71 item.setText("Paste");
72 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
73 MenuBarFactory.MENU_MASK));
74 menu.add(item);
75
76 }// END: populateMenu
77
78 @Override
79 public String getMenuName() {
80 return "Edit";
81 }
82
83 @Override
84 public int getPreferredAlignment() {
85 return LEFT;
86 }
87
88 }//END: class