public void generateCode ( ) {
		// generate the output code for the menus
		StringBuilder sb = new StringBuilder( 8192 );
		StringBuilder sbCode = new StringBuilder( 4096 );
		String sLabels = ""; //$NON-NLS-1$
		String sMenus = "PROGMEM const char *menu_items[] = {\r\n"; //$NON-NLS-1$
		String s;
		sb.append( "#include <avr/pgmspace.h>\r\n" ); //$NON-NLS-1$
		for ( int i = 0; i < iMenuQuantity; i++ ) {
			s =
					String.format(	"prog_char menu%d_label[] PROGMEM = \"%s\";\r\n", //$NON-NLS-1$
									i, saLabels[i] );
			sLabels += s;
			s = String.format( "menu%d_label%c ", i, //$NON-NLS-1$
								(i + 1 == iMenuQuantity) ? ' ' : ',' );
			sMenus += s;
			s = String.format( "void MenuEntry%d()\r\n{\r\n", i + 1 ); //$NON-NLS-1$
			sbCode.append( s );
			sbCode.append( saCode[i] );
			sbCode.append( "\r\n}\r\n" ); //$NON-NLS-1$
		}
		sMenus += "};\r\n\r\n"; //$NON-NLS-1$

		sb.append( sLabels );
		sb.append( sMenus );
		sb.append( sbCode );

		String sInit =
				"// Initialize the menu\r\nReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));"; //$NON-NLS-1$
		CodeWindow cw = null;
		boolean canProceed = true;
		Window[] dialogs = JDialog.getWindows();
		for ( Window dlg : dialogs ) {
			if ( dlg.getClass().equals( CodeWindow.class ) ) {
				if ( dlg.isDisplayable() ) {
					cw = (CodeWindow) dlg;
					canProceed = false;
				}
				if ( !canProceed ) {
					break;
				}
			}
		}
		if ( canProceed ) {
			cw = new CodeWindow( MenuApp.getFrame() );
		}
		cw.setCodeText( sb );
		cw.setCodeSetup( sInit );
		cw.setLocationRelativeTo( cw.getParent() );
		cw.setVisible( true );
	}