Example usage for java.awt.event KeyEvent VK_2

List of usage examples for java.awt.event KeyEvent VK_2

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_2.

Prototype

int VK_2

To view the source code for java.awt.event KeyEvent VK_2.

Click Source Link

Document

Constant for the "2" key.

Usage

From source file:FocusTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame();
    Container contentPane = frame.getContentPane();

    FocusListener listener = new FocusListener() {
        public void focusGained(FocusEvent e) {
            dumpInfo(e);/*from   w w  w  .  j a va2  s .  c o  m*/
        }

        public void focusLost(FocusEvent e) {
            dumpInfo(e);
        }

        private void dumpInfo(FocusEvent e) {
            System.out.println("Source  : " + name(e.getComponent()));
            System.out.println("Opposite : " + name(e.getOppositeComponent()));
            System.out.println("Temporary: " + e.isTemporary());
        }

        private String name(Component c) {
            return (c == null) ? null : c.getName();
        }
    };

    // First
    JPanel panel = new JPanel();
    JLabel label = new JLabel("Label 1: ");
    JTextField text = new JTextField("Type your text", 15);
    text.setName("First");
    text.addFocusListener(listener);
    label.setDisplayedMnemonic(KeyEvent.VK_1);
    label.setLabelFor(text);
    panel.add(label);
    panel.add(text);
    contentPane.add(panel, BorderLayout.NORTH);

    // Second
    panel = new JPanel();
    label = new JLabel("Label 2: ");
    text = new JTextField("14.0", 10);
    text.setName("Second");
    text.addFocusListener(listener);
    text.setHorizontalAlignment(JTextField.RIGHT);
    label.setDisplayedMnemonic(KeyEvent.VK_2);
    label.setLabelFor(text);
    panel.add(label);
    panel.add(text);
    contentPane.add(panel, BorderLayout.SOUTH);

    frame.pack();
    frame.show();
}

From source file:Main.java

/**
 * Returns the mnemonic integer./*from  w  ww . ja  va2  s.com*/
 * 
 * @param c The character (uppercase)
 * @return The mnemonic.
 */
@SuppressWarnings("incomplete-switch")
private static int setMnemonicsGet(char c) {
    int mnemonic = 0;
    switch (Character.toUpperCase(c)) {
    case '0':
        mnemonic = KeyEvent.VK_0;
        break;
    case '1':
        mnemonic = KeyEvent.VK_1;
        break;
    case '2':
        mnemonic = KeyEvent.VK_2;
        break;
    case '3':
        mnemonic = KeyEvent.VK_3;
        break;
    case '4':
        mnemonic = KeyEvent.VK_4;
        break;
    case '5':
        mnemonic = KeyEvent.VK_5;
        break;
    case '6':
        mnemonic = KeyEvent.VK_6;
        break;
    case '7':
        mnemonic = KeyEvent.VK_7;
        break;
    case '8':
        mnemonic = KeyEvent.VK_8;
        break;
    case '9':
        mnemonic = KeyEvent.VK_9;
        break;
    case 'A':
        mnemonic = KeyEvent.VK_A;
        break;
    case 'B':
        mnemonic = KeyEvent.VK_B;
        break;
    case 'C':
        mnemonic = KeyEvent.VK_C;
        break;
    case 'D':
        mnemonic = KeyEvent.VK_D;
        break;
    case 'E':
        mnemonic = KeyEvent.VK_E;
        break;
    case 'F':
        mnemonic = KeyEvent.VK_F;
        break;
    case 'G':
        mnemonic = KeyEvent.VK_G;
        break;
    case 'H':
        mnemonic = KeyEvent.VK_H;
        break;
    case 'I':
        mnemonic = KeyEvent.VK_I;
        break;
    case 'J':
        mnemonic = KeyEvent.VK_J;
        break;
    case 'K':
        mnemonic = KeyEvent.VK_K;
        break;
    case 'L':
        mnemonic = KeyEvent.VK_L;
        break;
    case 'M':
        mnemonic = KeyEvent.VK_M;
        break;
    case 'N':
        mnemonic = KeyEvent.VK_N;
        break;
    case 'O':
        mnemonic = KeyEvent.VK_O;
        break;
    case 'P':
        mnemonic = KeyEvent.VK_P;
        break;
    case 'Q':
        mnemonic = KeyEvent.VK_Q;
        break;
    case 'R':
        mnemonic = KeyEvent.VK_R;
        break;
    case 'S':
        mnemonic = KeyEvent.VK_S;
        break;
    case 'T':
        mnemonic = KeyEvent.VK_T;
        break;
    case 'U':
        mnemonic = KeyEvent.VK_U;
        break;
    case 'V':
        mnemonic = KeyEvent.VK_V;
        break;
    case 'W':
        mnemonic = KeyEvent.VK_W;
        break;
    case 'X':
        mnemonic = KeyEvent.VK_X;
        break;
    case 'Y':
        mnemonic = KeyEvent.VK_Y;
        break;
    case 'Z':
        mnemonic = KeyEvent.VK_Z;
        break;
    }
    return mnemonic;
}

From source file:Main.java

public Main() {
    super(new GridLayout(1, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon icon = createImageIcon("images/middle.gif");

    JComponent panel1 = makeTextPanel("Panel #1");
    tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    JComponent panel2 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    JComponent panel3 = makeTextPanel("Panel #3");
    tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
    panel4.setPreferredSize(new Dimension(410, 50));
    tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    add(tabbedPane);/*  w  ww  . j a v  a2 s  .c  o m*/

    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}

From source file:components.TabbedPaneDemo.java

public TabbedPaneDemo() {
    super(new GridLayout(1, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon icon = createImageIcon("images/middle.gif");

    JComponent panel1 = makeTextPanel("Panel #1");
    tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    JComponent panel2 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    JComponent panel3 = makeTextPanel("Panel #3");
    tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
    panel4.setPreferredSize(new Dimension(410, 50));
    tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    //Add the tabbed pane to this panel.
    add(tabbedPane);/*from  w w w.  j  av a  2s  . c o  m*/

    //The following line enables to use scrolling tabs.
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}

From source file:TabbedPaneDemo.java

public TabbedPaneDemo() {
    super(new GridLayout(1, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon icon = createImageIcon("images/middle.gif");

    JComponent panel1 = makeTextPanel("Panel #1");
    tabbedPane.addTab("Tab 1", icon, panel1, "Does nothing");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    JComponent panel2 = makeTextPanel("Panel #2");
    tabbedPane.addTab("Tab 2", icon, panel2, "Does twice as much nothing");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    JComponent panel3 = makeTextPanel("Panel #3");
    tabbedPane.addTab("Tab 3", icon, panel3, "Still does nothing");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    JComponent panel4 = makeTextPanel("Panel #4 (has a preferred size of 410 x 50).");
    panel4.setPreferredSize(new Dimension(410, 50));
    tabbedPane.addTab("Tab 4", icon, panel4, "Does nothing at all");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    //Add the tabbed pane to this panel.
    add(tabbedPane);/*  w w  w .  j av a2  s.  c o  m*/

    //Uncomment the following line to use scrolling tabs.
    //tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
}

From source file:components.MenuLookDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar;//from  w  ww .  j  a v a  2 s. c om
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    //Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    //a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("images/middle.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menu.add(menuItem);

    //a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    menu.add(rbMenuItem);

    //a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    menu.add(cbMenuItem);

    //a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    submenu.add(menuItem);
    menu.add(submenu);

    //Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    return menuBar;
}

From source file:MenuLookDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar;/*  w ww . j  ava 2 s. c o  m*/
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    // a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    // menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("images/middle.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menu.add(menuItem);

    // a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    menu.add(rbMenuItem);

    // a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    menu.add(cbMenuItem);

    // a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    submenu.add(menuItem);
    menu.add(submenu);

    // Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    return menuBar;
}

From source file:components.MenuDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar;//  w ww  . jav a2  s  .c o m
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    //Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    //a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("images/middle.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    //a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    //a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    //a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    menuItem.addActionListener(this);
    submenu.add(menuItem);
    menu.add(submenu);

    //Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    return menuBar;
}

From source file:components.MenuSelectionManagerDemo.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar;/*  w w  w. j a  v  a  2s. c o  m*/
    JMenu menu, submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;
    JCheckBoxMenuItem cbMenuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    //Build the first menu.
    menu = new JMenu("A Menu");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    //a group of JMenuItems
    menuItem = new JMenuItem("A text-only menu item", KeyEvent.VK_T);
    //menuItem.setMnemonic(KeyEvent.VK_T); //used constructor instead
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("This doesn't really do anything");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    ImageIcon icon = createImageIcon("images/middle.gif");
    menuItem = new JMenuItem("Both text and icon", icon);
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    menuItem = new JMenuItem(icon);
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(this);
    menu.add(menuItem);

    //a group of radio button menu items
    menu.addSeparator();
    ButtonGroup group = new ButtonGroup();

    rbMenuItem = new JRadioButtonMenuItem("A radio button menu item");
    rbMenuItem.setSelected(true);
    rbMenuItem.setMnemonic(KeyEvent.VK_R);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    rbMenuItem = new JRadioButtonMenuItem("Another one");
    rbMenuItem.setMnemonic(KeyEvent.VK_O);
    group.add(rbMenuItem);
    rbMenuItem.addActionListener(this);
    menu.add(rbMenuItem);

    //a group of check box menu items
    menu.addSeparator();
    cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
    cbMenuItem.setMnemonic(KeyEvent.VK_C);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("Another one");
    cbMenuItem.setMnemonic(KeyEvent.VK_H);
    cbMenuItem.addItemListener(this);
    menu.add(cbMenuItem);

    //a submenu
    menu.addSeparator();
    submenu = new JMenu("A submenu");
    submenu.setMnemonic(KeyEvent.VK_S);

    menuItem = new JMenuItem("An item in the submenu");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
    menuItem.addActionListener(this);
    submenu.add(menuItem);

    menuItem = new JMenuItem("Another item");
    menuItem.addActionListener(this);
    submenu.add(menuItem);
    menu.add(submenu);

    //Build second menu in the menu bar.
    menu = new JMenu("Another Menu");
    menu.setMnemonic(KeyEvent.VK_N);
    menu.getAccessibleContext().setAccessibleDescription("This menu does nothing");
    menuBar.add(menu);

    Timer timer = new Timer(ONE_SECOND, new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath();
            for (int i = 0; i < path.length; i++) {
                if (path[i].getComponent() instanceof javax.swing.JMenuItem) {
                    JMenuItem mi = (JMenuItem) path[i].getComponent();
                    if ("".equals(mi.getText())) {
                        output.append("ICON-ONLY MENU ITEM > ");
                    } else {
                        output.append(mi.getText() + " > ");
                    }
                }
            }
            if (path.length > 0)
                output.append(newline);
        }
    });
    timer.start();
    return menuBar;
}

From source file:be.fedict.eid.tsl.tool.TslTool.java

private void initNewMenu(JMenu fileMenu) {
    JMenu newMenu = new JMenu("New");
    newMenu.setMnemonic(KeyEvent.VK_N);
    fileMenu.add(newMenu);/*from  w w  w. j av  a  2  s  .  co m*/

    JMenu belgiumMenu = new JMenu("Belgium");
    newMenu.add(belgiumMenu);

    JMenu _2010BelgiumMenu = new JMenu("2010");
    belgiumMenu.add(_2010BelgiumMenu);

    JMenuItem _2010_T1_BelgiumMenuItem = addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2010-T1",
            _2010BelgiumMenu, true);
    _2010BelgiumMenu.add(_2010_T1_BelgiumMenuItem);

    JMenuItem _2010_T2_BelgiumMenuItem = addActionMenuItem("Trimester 2", KeyEvent.VK_2, "TSL-BE-2010-T2",
            _2010BelgiumMenu, true);
    _2010BelgiumMenu.add(_2010_T2_BelgiumMenuItem);

    JMenuItem _2010_T3_BelgiumMenuItem = addActionMenuItem("Trimester 3", KeyEvent.VK_3, "TSL-BE-2010-T3",
            _2010BelgiumMenu, true);
    _2010BelgiumMenu.add(_2010_T3_BelgiumMenuItem);

    JMenu _2011BelgiumMenu = new JMenu("2011");
    belgiumMenu.add(_2011BelgiumMenu);

    addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2011-T1", _2011BelgiumMenu, true);
    addActionMenuItem("Trimester 2", KeyEvent.VK_2, "TSL-BE-2011-T2", _2011BelgiumMenu, true);
    addActionMenuItem("Trimester 3", KeyEvent.VK_3, "TSL-BE-2011-T3", _2011BelgiumMenu, true);

    JMenu _2012BelgiumMenu = new JMenu("2012");
    belgiumMenu.add(_2012BelgiumMenu);

    addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2012-T1", _2012BelgiumMenu, true);
    addActionMenuItem("Trimester 2", KeyEvent.VK_2, "TSL-BE-2012-T2", _2012BelgiumMenu, true);
    addActionMenuItem("Trimester 3", KeyEvent.VK_3, "TSL-BE-2012-T3", _2012BelgiumMenu, true);

    JMenu _2013BelgiumMenu = new JMenu("2013");
    belgiumMenu.add(_2013BelgiumMenu);

    addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2013-T1", _2013BelgiumMenu, true);
    addActionMenuItem("Trimester 2", KeyEvent.VK_2, "TSL-BE-2013-T2", _2013BelgiumMenu, true);
    addActionMenuItem("Trimester 3", KeyEvent.VK_3, "TSL-BE-2013-T3", _2013BelgiumMenu, true);

    JMenu _2014BelgiumMenu = new JMenu("2014");
    belgiumMenu.add(_2014BelgiumMenu);

    addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2014-T1", _2014BelgiumMenu, true);
    addActionMenuItem("Trimester 2", KeyEvent.VK_1, "TSL-BE-2014-T2", _2014BelgiumMenu, true);
    addActionMenuItem("Trimester 3", KeyEvent.VK_1, "TSL-BE-2014-T3", _2014BelgiumMenu, true);

    JMenu _2015BelgiumMenu = new JMenu("2015");
    belgiumMenu.add(_2015BelgiumMenu);

    addActionMenuItem("Trimester 1", KeyEvent.VK_1, "TSL-BE-2015-T1", _2015BelgiumMenu, true);
    addActionMenuItem("Trimester 2", KeyEvent.VK_1, "TSL-BE-2015-T2", _2015BelgiumMenu, true);
    addActionMenuItem("Trimester 3", KeyEvent.VK_1, "TSL-BE-2015-T3", _2015BelgiumMenu, true);

}