Thanks. I knew about the cable car but haven't really seen a lot of the other things.
My favorite beach is Sveti Jakov beach.
Lokrum Island is also nice for swimming, it's very peaceful and full of rabbits and peacocks.
You have 4 days so I think you need 3 days to explore the Old Town, do the cable car, Lokrum Island and beaches and 1 day for a day trip is enough.
You can check out things to do in Dubrovnik here.