*/
package jalview.appletgui;
+import jalview.util.Platform;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
* @author Jim Procter and Andrew Waterhouse
*
*/
-public class EmbmenuFrame extends Frame implements MouseListener
+public class EmbmenuFrame extends Frame
+ implements MouseListener, AutoCloseable
{
- protected static final Font FONT_ARIAL_PLAIN_11 = new Font(
- "Arial", Font.PLAIN, 11);
+ 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<Label, PopupMenu> embeddedPopup = new HashMap<Label, PopupMenu>();
+ protected Map<Label, PopupMenu> embeddedPopup = new HashMap<>();
/**
* the embedded menu is built on this and should be added to the frame at the
return false;
}
// DEBUG Hint: can test embedded menus by inserting true here.
- if (new jalview.util.Platform().isAMac())
+ if (Platform.isAMacAndNotJS())
{
// Build the embedded menu panel, allowing override with system font
embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, true, false);
* @return the panel instance for convenience.
*/
protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, Font font,
- boolean overrideFonts,
- Panel embeddedMenu,
+ boolean overrideFonts, Panel embeddedMenu,
MouseListener clickHandler)
{
if (overrideFonts)
return embeddedMenu;
}
+ @Override
public void mousePressed(MouseEvent evt)
{
PopupMenu popup = null;
if (popup != null)
{
embeddedMenu.add(popup);
- popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y
- + source.getBounds().getSize().height);
+ popup.show(embeddedMenu, source.getBounds().x,
+ source.getBounds().y + source.getBounds().getSize().height);
}
}
return embeddedPopup.get(source);
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
+ @Override
public void mouseExited(MouseEvent evt)
{
}
/**
* calls destroyMenus()
*/
- public void finalize() throws Throwable
+ @Override
+ public void close()
{
destroyMenus();
embeddedPopup = null;
embeddedMenu = null;
- super.finalize();
}
}