class RotationMenu extends MenuBase
{
    public static final String ROTATE_0_DEGREES = "0°";
    public static final String ROTATE_90_DEGREES = "90°";
    public static final String ROTATE_180_DEGREES = "180°";
    public static final String ROTATE_270_DEGREES = "270°";
    
    private static RotationMenu instance;
    private JRadioButtonMenuItem rotate0Item;
    private JRadioButtonMenuItem rotate90Item;
    private JRadioButtonMenuItem rotate180Item;
    private JRadioButtonMenuItem rotate270Item;

    /**
     * Constructor.
     */
    private RotationMenu()
    {
        setMenu(createRotationMenu());
    }
  
    /**
     * Provides the RotationMenu instance.
     * @return RotationMenu instance.
     */
    public static RotationMenu getInstance()
    {
        if (instance == null)
        {
            instance = new RotationMenu();
        }
        return instance;
    }

    /**
     * Set the rotation selection.
     * @param selection String instance.
     */
    public void setRotationSelection(String selection)
    {
        switch (selection)
        {
            case ROTATE_0_DEGREES:
                rotate0Item.setSelected(true);
                break;
            case ROTATE_90_DEGREES:
                rotate90Item.setSelected(true);
                break;
            case ROTATE_180_DEGREES:
                rotate180Item.setSelected(true);
                break;
            case ROTATE_270_DEGREES:
                rotate270Item.setSelected(true);
                break;
            default:
                throw new IllegalArgumentException("Invalid rotation selection: " + selection);
        }
    }

    public static boolean isRotationMenu(String actionCommand)
    {
        return ROTATE_0_DEGREES.equals(actionCommand) || ROTATE_90_DEGREES.equals(actionCommand) ||
                ROTATE_180_DEGREES.equals(actionCommand) || ROTATE_270_DEGREES.equals(actionCommand);
    }
    
    public static int getRotationDegrees()
    {
        if (instance.rotate90Item.isSelected())
        {
            return 90;
        }
        if (instance.rotate180Item.isSelected())
        {
            return 180;
        }
        if (instance.rotate270Item.isSelected())
        {
            return 270;
        }
        return 0;
    }

    public static int getRotationDegrees(String actionCommand)
    {<FILL_FUNCTION_BODY>}

    private JMenu createRotationMenu()
    {
        JMenu menu = new JMenu();
        menu.setText("Rotation");

        rotate0Item = new JRadioButtonMenuItem();
        rotate90Item = new JRadioButtonMenuItem();
        rotate180Item = new JRadioButtonMenuItem();
        rotate270Item = new JRadioButtonMenuItem();
        rotate0Item.setSelected(true);

        ButtonGroup bg = new ButtonGroup();
        bg.add(rotate0Item);
        bg.add(rotate90Item);
        bg.add(rotate180Item);
        bg.add(rotate270Item);

        rotate0Item.setText(ROTATE_0_DEGREES);
        rotate90Item.setText(ROTATE_90_DEGREES);
        rotate180Item.setText(ROTATE_180_DEGREES);
        rotate270Item.setText(ROTATE_270_DEGREES);
        
        menu.add(rotate0Item);
        menu.add(rotate90Item);
        menu.add(rotate180Item);
        menu.add(rotate270Item);

        return menu;
    }
}

        switch (actionCommand)
        {
            case ROTATE_0_DEGREES:
                return 0;
            case ROTATE_90_DEGREES:
                return 90;
            case ROTATE_180_DEGREES:
                return 180;
            case ROTATE_270_DEGREES:
                return 270;
            default:
                throw new IllegalArgumentException("Invalid RotationDegrees actionCommand " + actionCommand);
        }
    
<methods>public void addMenuListeners(java.awt.event.ActionListener) ,public javax.swing.JMenu getMenu() ,public void setEnableMenu(boolean) <variables>private javax.swing.JMenu menu