class ImageTypeMenu extends MenuBase
{
    public static final String IMAGETYPE_RGB = "RGB";
    public static final String IMAGETYPE_ARGB = "ARGB";
    public static final String IMAGETYPE_GRAY = "Gray";
    public static final String IMAGETYPE_BITONAL = "Bitonal";
    
    private static ImageTypeMenu instance;
    private JRadioButtonMenuItem rgbItem;
    private JRadioButtonMenuItem argbItem;
    private JRadioButtonMenuItem grayItem;
    private JRadioButtonMenuItem bitonalItem;

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

    /**
     * Set the image type selection.
     * @param selection String instance.
     */
    public void setImageTypeSelection(String selection)
    {
        switch (selection)
        {
            case IMAGETYPE_RGB:
                rgbItem.setSelected(true);
                break;
            case IMAGETYPE_ARGB:
                argbItem.setSelected(true);
                break;
            case IMAGETYPE_GRAY:
                grayItem.setSelected(true);
                break;
            case IMAGETYPE_BITONAL:
                bitonalItem.setSelected(true);
                break;
            default:
                throw new IllegalArgumentException("Invalid ImageType selection: " + selection);
        }
    }

    public static boolean isImageTypeMenu(String actionCommand)
    {
        return IMAGETYPE_RGB.equals(actionCommand) || IMAGETYPE_ARGB.equals(actionCommand) ||
                IMAGETYPE_GRAY.equals(actionCommand) || IMAGETYPE_BITONAL.equals(actionCommand);
    }
    
    public static ImageType getImageType()
    {
        if (instance.argbItem.isSelected())
        {
            return ImageType.ARGB;
        }
        if (instance.grayItem.isSelected())
        {
            return ImageType.GRAY;
        }
        if (instance.bitonalItem.isSelected())
        {
            return ImageType.BINARY;
        }
        return ImageType.RGB;
    }

    public static ImageType getImageType(String actionCommand)
    {<FILL_FUNCTION_BODY>}

    private JMenu createMenu()
    {
        JMenu menu = new JMenu();
        menu.setText("Image type");

        rgbItem = new JRadioButtonMenuItem();
        argbItem = new JRadioButtonMenuItem();
        grayItem = new JRadioButtonMenuItem();
        bitonalItem = new JRadioButtonMenuItem();
        rgbItem.setSelected(true);

        ButtonGroup bg = new ButtonGroup();
        bg.add(rgbItem);
        bg.add(argbItem);
        bg.add(grayItem);
        bg.add(bitonalItem);

        rgbItem.setText(IMAGETYPE_RGB);
        argbItem.setText(IMAGETYPE_ARGB);
        grayItem.setText(IMAGETYPE_GRAY);
        bitonalItem.setText(IMAGETYPE_BITONAL);
        
        menu.add(rgbItem);
        menu.add(argbItem);
        menu.add(grayItem);
        menu.add(bitonalItem);

        return menu;
    }
}

        switch (actionCommand)
        {
            case IMAGETYPE_RGB:
                return ImageType.RGB;
            case IMAGETYPE_ARGB:
                return ImageType.ARGB;
            case IMAGETYPE_GRAY:
                return ImageType.GRAY;
            case IMAGETYPE_BITONAL:
                return ImageType.BINARY;
            default:
                throw new IllegalArgumentException("Invalid ImageType 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