In 1784 , the French sold the island to Sweden , who renamed the largest town Gustavia , after the Swedish King GUSTAV III , and made it a free port ; the island prospered as a trade and supply center during the colonial wars of the 18th century .