/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview 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.
*
* Jalview 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 Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.Label;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.Panel;
import java.awt.PopupMenu;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.HashMap;
import java.util.Map;
/**
* This class implements a pattern for embedding toolbars as a panel with popups
* for situations where the system menu bar is either invisible or
* inappropriate. It was derived from the code for embedding the jalview applet
* alignFrame as a component on the web-page, which requires the local
* alignFrame menu to be attached to that panel rather than placed on the parent
* (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so
* it looks like a real toolbar menu TODO: modify click/mouse handler for
* embeddedMenu so it behaves more like a real pulldown menu toolbar
*
* @author Jim Procter and Andrew Waterhouse
*
*/
public class EmbmenuFrame extends Frame implements MouseListener
{
protected static final Font FONT_ARIAL_PLAIN_11 = new Font("Arial",
Font.PLAIN, 11);
public static final Font DEFAULT_MENU_FONT = FONT_ARIAL_PLAIN_11;
/**
* map from labels to popup menus for the embedded menubar
*/
protected Map