Java Code Examples for java.awt.Menu

The following are top voted examples for showing how to use java.awt.Menu. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: litiengine   File: Program.java   Source Code and License 6 votes vote down vote up
private static Menu initProjectMenu() {
  Menu mnProject = new Menu(Resources.get("menu_project"));

  CheckboxMenuItem compress = new CheckboxMenuItem(Resources.get("menu_compressProjectFile"));
  compress.setState(userPreferences.isCompressFile());
  compress.addItemListener(e -> userPreferences.setCompressFile(compress.getState()));

  CheckboxMenuItem sync = new CheckboxMenuItem(Resources.get("menu_syncMaps"));
  sync.setState(userPreferences.isSyncMaps());
  sync.addItemListener(e -> userPreferences.setSyncMaps(sync.getState()));

  MenuItem importSpriteFile = new MenuItem(Resources.get("menu_assets_importSpriteFile"));
  importSpriteFile.addActionListener(a -> EditorScreen.instance().importSpriteFile());

  MenuItem importSprite = new MenuItem(Resources.get("menu_assets_importSprite"));
  importSprite.addActionListener(a -> EditorScreen.instance().importSprites());

  mnProject.add(importSprite);
  mnProject.add(importSpriteFile);
  mnProject.addSeparator();
  mnProject.add(compress);
  mnProject.add(sync);

  return mnProject;
}
 
Example 2
Project: OpenDiabetes   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 3
Project: sstore-soft   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 4
Project: s-store   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 5
Project: dev-courses   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 6
Project: dev-courses   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenuItems(Menu f, String[] m) {

        for (int i = 0; i < m.length; i++) {
            MenuItem item = new MenuItem(m[i].substring(1));
            char     c    = m[i].charAt(0);

            if (c != '-') {
                item.setShortcut(new MenuShortcut(c));
            }

            item.addActionListener(this);
            f.add(item);
        }
    }
 
Example 7
Project: parabuild-ci   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 8
Project: parabuild-ci   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 9
Project: parabuild-ci   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param b
 * @param name
 * @param items
 */
void addMenu(MenuBar b, String name, String[] items) {

    /* It's a very poor design to encapsulate menu creation this way.
     * Can't customize the menus this way (e.g. shortcut keys,
     * mnemonics, disabling, etc. */
    Menu menu = new Menu(name);

    if (name.equals("Tools") && !TT_AVAILABLE) {

        // Terrible place to do this.  Forced to due to method design.
        menu.setEnabled(false);
    }

    addMenuItems(menu, items);
    b.add(menu);
}
 
Example 10
Project: jdk8u-jdk   File: RemoveHelpMenu.java   Source Code and License 6 votes vote down vote up
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
 
Example 11
Project: openjdk-jdk10   File: RemoveHelpMenu.java   Source Code and License 6 votes vote down vote up
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
 
Example 12
Project: openjdk9   File: RemoveHelpMenu.java   Source Code and License 6 votes vote down vote up
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
 
Example 13
Project: jdk8u_jdk   File: RemoveHelpMenu.java   Source Code and License 6 votes vote down vote up
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
 
Example 14
Project: lookaside_java-1.8.0-openjdk   File: RemoveHelpMenu.java   Source Code and License 6 votes vote down vote up
private static void test3(final MenuBar menuBar) {
    final Menu helpMenu1 = new Menu("Help Menu1");
    final Menu helpMenu2 = new Menu("Help Menu2");
    menuBar.setHelpMenu(helpMenu1);
    checkCurrentMenu(menuBar, helpMenu1);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, true);
    checkHelpMenu(helpMenu2, false);

    menuBar.setHelpMenu(helpMenu2);
    checkCurrentMenu(menuBar, helpMenu2);
    checkMenuCount(menuBar, 1);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, true);

    menuBar.remove(helpMenu2);
    checkCurrentMenu(menuBar, null);
    checkMenuCount(menuBar, 0);
    checkHelpMenu(helpMenu1, false);
    checkHelpMenu(helpMenu2, false);
}
 
Example 15
Project: javify   File: GtkMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
 
Example 16
Project: javify   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse events.
 *
 * @param ev the mouse event
 */
public void handleMouseEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseEvent(ev);
          break;
        }
    }
}
 
Example 17
Project: javify   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse motion events.
 *
 * @param ev the mouse motion event
 */
public void handleMouseMotionEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseMotionEvent(ev);
          break;
        }
    }
}
 
Example 18
Project: Tingeltangel   File: MasterFrameMenu.java   Source Code and License 6 votes vote down vote up
private static MenuItem generateMenuItem(TreeElement element) {
    if(element.isLeaf()) {
        MenuItem item = new MenuItem(element.getCaption());
        item.addActionListener(new MasterFrameMenu(element.getFullID()));
        if(element.isHidden()) {
            item.setEnabled(false);
        } else if(!element.getEnabled()) {
            item.setEnabled(false);
        }
        items.put(element.getFullID(), item);
        return(item);
    } else {
        Menu menu = new Menu(element.getCaption());
        Iterator<TreeElement> i = element.getChilds();
        while(i.hasNext()) {
            menu.add(generateMenuItem(i.next()));
        }
        if(element.isHidden()) {
            menu.setEnabled(false);
        }
        items.put(element.getFullID(), menu);
        return(menu);
    }
}
 
Example 19
Project: jvm-stm   File: GtkMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
 
Example 20
Project: jvm-stm   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse events.
 *
 * @param ev the mouse event
 */
public void handleMouseEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseEvent(ev);
          break;
        }
    }
}
 
Example 21
Project: jvm-stm   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse motion events.
 *
 * @param ev the mouse motion event
 */
public void handleMouseMotionEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseMotionEvent(ev);
          break;
        }
    }
}
 
Example 22
Project: VoltDB   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 23
Project: VoltDB   File: Transfer.java   Source Code and License 6 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param f
 * @param m
 */
private void addMenuItems(Menu f, String[] m) {

    for (int i = 0; i < m.length; i++) {
        if (m[i].equals("-")) {
            f.addSeparator();
        } else {
            MenuItem item = new MenuItem(m[i]);

            item.addActionListener(this);
            f.add(item);
        }
    }
}
 
Example 24
Project: wwwa   File: AWTExample.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
	
	Container container = new Container();
	Panel panel = new Panel();
	Menu menu = new Menu();	   			//!!! its not component
	TextField textField = new TextField();
	container.add(textField);
	
	Window win = new Window(null);
	win.pack();
	
	
	menu.setShortcut(new MenuShortcut(12));
	new MenuItem("label", new MenuShortcut(33, true));
	
	Menu file = new Menu("File"); 
	MenuItem print; 
	file.add(print = new MenuItem("Print", new MenuShortcut('p'))); 

}
 
Example 25
Project: Pegasus   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 26
Project: JamVM-PH   File: GtkMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
 
Example 27
Project: JamVM-PH   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse events.
 *
 * @param ev the mouse event
 */
public void handleMouseEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseEvent(ev);
          break;
        }
    }
}
 
Example 28
Project: JamVM-PH   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse motion events.
 *
 * @param ev the mouse motion event
 */
public void handleMouseMotionEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseMotionEvent(ev);
          break;
        }
    }
}
 
Example 29
Project: javafx-demos   File: TrayLeftClick.java   Source Code and License 6 votes vote down vote up
protected static PopupMenu createPopupMenu() {
    final PopupMenu popup = new PopupMenu();
    MenuItem aboutItem = new MenuItem("About");
    CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
    CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
    Menu displayMenu = new Menu("Display");
    MenuItem errorItem = new MenuItem("Error");
    MenuItem warningItem = new MenuItem("Warning");
    MenuItem infoItem = new MenuItem("Info");
    MenuItem noneItem = new MenuItem("None");
    MenuItem exitItem = new MenuItem("Exit");
    // Add components to pop-up menu
    popup.add(aboutItem);
    popup.addSeparator();
    popup.add(cb1);
    popup.add(cb2);
    popup.addSeparator();
    popup.add(displayMenu);
    displayMenu.add(errorItem);
    displayMenu.add(warningItem);
    displayMenu.add(infoItem);
    displayMenu.add(noneItem);
    popup.add(exitItem);
    return popup;
}
 
Example 30
Project: classpath   File: GtkMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Adds a help menu to this MenuBar. Gnome styleguides say the help
 * menu is just the last item in the menubar (they are NOT right
 * justified).
 */
public void addHelpMenu (Menu menu)
{
  if (hasHelpMenu)
    {
      // Remove the (help) menu, which is after all the other items.
      delMenu(((MenuBar) awtWidget).getMenuCount());
      hasHelpMenu = false;
    }

  if (menu != null)
    {
      addMenu(menu);
      hasHelpMenu = true;
    }
}
 
Example 31
Project: classpath   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse events.
 *
 * @param ev the mouse event
 */
public void handleMouseEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseEvent(ev);
          break;
        }
    }
}
 
Example 32
Project: classpath   File: SwingMenuBarPeer.java   Source Code and License 6 votes vote down vote up
/**
 * Handles mouse motion events.
 *
 * @param ev the mouse motion event
 */
public void handleMouseMotionEvent(MouseEvent ev)
{
  Point point = ev.getPoint();
  for (int i = 0; i < awtMenuBar.getMenuCount(); i++)
    {
      Menu menu = awtMenuBar.getMenu(i);
      SwingMenuPeer peer = (SwingMenuPeer) menu.getPeer();
      int x1 = peer.getX();
      int x2 = x1 + peer.getWidth();
      if (point.x >= x1 && point.x <= x2)
        {
          ev.translatePoint(peer.getX(), peer.getY());
          peer.handleMouseMotionEvent(ev);
          break;
        }
    }
}
 
Example 33
Project: Mobile-Network-LTE   File: DatabaseManager.java   Source Code and License 6 votes vote down vote up
void addMenu(MenuBar b, String name, String[] items) {

        /* It's a very poor design to encapsulate menu creation this way.
         * Can't customize the menus this way (e.g. shortcut keys,
         * mnemonics, disabling, etc. */
        Menu menu = new Menu(name);

        if (name.equals("Tools") && !TT_AVAILABLE) {

            // Terrible place to do this.  Forced to due to method design.
            menu.setEnabled(false);
        }

        addMenuItems(menu, items);
        b.add(menu);
    }
 
Example 34
Project: jago   File: OpenPartnerFrame.java   Source Code and License 6 votes vote down vote up
public OpenPartnerFrame (Go go)
{
	super(Global.resourceString("Open_Partners"));
	G = go;
	MenuBar mb = new MenuBar();
	setMenuBar(mb);
	Menu m = new MyMenu(Global.resourceString("Options"));
	m.add(new MenuItemAction(this, Global.resourceString("Close")));
	mb.add(m);
	setLayout(new BorderLayout());
	L = new java.awt.List();
	L.setFont(Global.SansSerif);
	refresh();
	add("Center", L);
	JPanel bp = new MyPanel();
	bp.add(new ButtonAction(this, Global.resourceString("Connect")));
	bp.add(new ButtonAction(this, Global.resourceString("Refresh")));
	bp.add(new MyLabel(" "));
	bp.add(new ButtonAction(this, Global.resourceString("Close")));
	add("South", bp);
	Global.setwindow(this, "openpartner", 300, 200);
	seticon("ijago.gif");
	setVisible(true);
	OPFU = new OpenPartnerFrameUpdate(this);
}
 
Example 35
Project: litiengine   File: Program.java   Source Code and License 5 votes vote down vote up
private static Menu initFileMenu() {
  Menu mnFile = new Menu(Resources.get("menu_file"));

  MenuItem create = new MenuItem(Resources.get("menu_createProject"));
  create.setShortcut(new MenuShortcut(KeyEvent.VK_N));
  create.addActionListener(a -> EditorScreen.instance().create());

  MenuItem load = new MenuItem(Resources.get("menu_loadProject"));
  load.setShortcut(new MenuShortcut(KeyEvent.VK_O));
  load.addActionListener(a -> EditorScreen.instance().load());

  MenuItem save = new MenuItem(Resources.get("menu_save"));
  save.setShortcut(new MenuShortcut(KeyEvent.VK_S));
  save.addActionListener(a -> EditorScreen.instance().save(false));

  MenuItem saveAs = new MenuItem(Resources.get("menu_saveAs"));
  saveAs.addActionListener(a -> EditorScreen.instance().save(true));

  MenuItem exit = new MenuItem(Resources.get("menu_exit"));
  exit.setShortcut(new MenuShortcut(KeyEvent.VK_Q));
  exit.addActionListener(a -> Game.terminate());

  mnFile.add(load);
  mnFile.add(create);
  mnFile.add(save);
  mnFile.add(saveAs);
  mnFile.addSeparator();
  recentFiles = new Menu(Resources.get("menu_recentFiles"));
  loadRecentFiles();
  mnFile.add(recentFiles);
  mnFile.addSeparator();
  mnFile.add(exit);
  return mnFile;
}
 
Example 36
Project: OpenDiabetes   File: DatabaseManager.java   Source Code and License 5 votes vote down vote up
void addMenuItems(Menu f, String[] m) {

        for (int i = 0; i < m.length; i++) {
            MenuItem item = new MenuItem(m[i].substring(1));
            char     c    = m[i].charAt(0);

            if (c != '-') {
                item.setShortcut(new MenuShortcut(c));
            }

            item.addActionListener(this);
            f.add(item);
        }
    }
 
Example 37
Project: OpenDiabetes   File: Transfer.java   Source Code and License 5 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param f
 * @param m
 */
private void addMenuItems(Menu f, String[] m) {

    for (int i = 0; i < m.length; i++) {
        if (m[i].equals("-")) {
            f.addSeparator();
        } else {
            MenuItem item = new MenuItem(m[i]);

            item.addActionListener(this);
            f.add(item);
        }
    }
}
 
Example 38
Project: sstore-soft   File: DatabaseManager.java   Source Code and License 5 votes vote down vote up
void addMenuItems(Menu f, String[] m) {

        for (int i = 0; i < m.length; i++) {
            MenuItem item = new MenuItem(m[i].substring(1));
            char     c    = m[i].charAt(0);

            if (c != '-') {
                item.setShortcut(new MenuShortcut(c));
            }

            item.addActionListener(this);
            f.add(item);
        }
    }
 
Example 39
Project: sstore-soft   File: Transfer.java   Source Code and License 5 votes vote down vote up
/**
 * Method declaration
 *
 *
 * @param f
 * @param m
 */
private void addMenuItems(Menu f, String[] m) {

    for (int i = 0; i < m.length; i++) {
        if (m[i].equals("-")) {
            f.addSeparator();
        } else {
            MenuItem item = new MenuItem(m[i]);

            item.addActionListener(this);
            f.add(item);
        }
    }
}
 
Example 40
Project: s-store   File: DatabaseManager.java   Source Code and License 5 votes vote down vote up
void addMenuItems(Menu f, String[] m) {

        for (int i = 0; i < m.length; i++) {
            MenuItem item = new MenuItem(m[i].substring(1));
            char     c    = m[i].charAt(0);

            if (c != '-') {
                item.setShortcut(new MenuShortcut(c));
            }

            item.addActionListener(this);
            f.add(item);
        }
    }