Dubrovnik creates a bit of a problem in a 14 day schedule, as you'll likely spend the better part of the day getting there. Your best bet is probably to fly from Munich or Vienna to DBV, so keep that in mind when you put this together.
Assuming you have a FULL 14 days (doesn't include travel to and from your trip), I'd suggest this:
Budapest - 4 days
Vienna - 4 days
Munich - 3 days
Dubrovnik - 3 days (including travel day)
If you were planning to take some day trips outside of Munich, perhaps to see some of the castles, I'd consider stealing a day from Budapest to add to Munich. Personally, I'd save DBV for another trip, and make sure I have some side trips to places like Neuschwanstein Castle and Melk. But however you end up splitting the days, my advice is don't leave Budapest and Vienna short...do your research on what you want to see and do in each city before making your final plans.