class ZoomMenuItem extends JRadioButtonMenuItem
    {
        private final int zoom;

        ZoomMenuItem(String text, int zoom)
        {
            super(text);
            this.zoom = zoom;
        }
    }

    private float pageZoomScale = 1;
    private float imageZoomScale = 1;
    private static final int[] ZOOMS = { 25, 50, 100, 150, 200, 400, 1000, 2000 };

    private static ZoomMenu instance;
    private final JMenu menu;

    /**
     * Constructor.
     */
    private ZoomMenu()
    {
        menu = new JMenu("Zoom");
        ButtonGroup bg = new ButtonGroup();
        for (int zoom : ZOOMS)
        {
            ZoomMenuItem zoomItem = new ZoomMenuItem(zoom + "%", zoom);
            bg.add(zoomItem);
            menu.add(zoomItem);
        }
        setMenu(menu);
    }

    /**
     * Provides the ZoomMenu instance.
     *
     * @return ZoomMenu instance.
     */
    public static ZoomMenu getInstance()
    {
        if (instance == null)
        {
            instance = new ZoomMenu();
        }
        return instance;
    }

    /**
     * Set the zoom selection.
     *
     * @param zoomValue the zoom factor, e.g. 1, 0.25, 4.
     *
     * @throws IllegalArgumentException if the parameter doesn't belong to a zoom menu item.
     */
    public void changeZoomSelection(float zoomValue)
    {
        int selection = (int) (zoomValue * 100);
        for (Component comp : menu.getMenuComponents())
        {
            ZoomMenuItem menuItem = (ZoomMenuItem) comp;
            if (menuItem.zoom == selection)
            {
                menuItem.setSelected(true);
                return;
            }
        }
        throw new IllegalArgumentException("no zoom menu item found for: " + selection + "%");
    }

    /**
     * Tell whether the command belongs to the zoom menu.
     *
     * @param actionCommand a menu command string.
     * @return true if the command is a zoom menu command, e.g. "100%", false if not.
     */
    public static boolean isZoomMenu(String actionCommand)
    {
        if (!actionCommand.matches("^\\d+%$"))
        {
            return false;
        }
        int zoom = Integer.parseInt(actionCommand.substring(0, actionCommand.length() - 1));
        return Arrays.binarySearch(ZOOMS, zoom) >= 0;
    }

    /**
     * Tell the current zoom scale.
     *
     * @return the current zoom scale.
     * @throws IllegalStateException if no zoom menu item is selected.
     */
    public static float getZoomScale()
    {<FILL_FUNCTION_BODY>

        for (Component comp : instance.menu.getMenuComponents())
        {
            ZoomMenuItem menuItem = (ZoomMenuItem) comp;
            if (menuItem.isSelected())
            {
                return menuItem.zoom / 100f;
            }
        }
        throw new IllegalStateException("no zoom menu item is selected");
    
<methods>public void addMenuListeners(java.awt.event.ActionListener) ,public javax.swing.JMenu getMenu() ,public void setEnableMenu(boolean) <variables>private javax.swing.JMenu menu