I have the contents of a <String, Bean>TreeMap displayed in a JTable. The leftmost column displays film titles (the String part of the TreeMap), mostly in English, but some in foreign languages such as French. The titles are in alphabetical order alright except if the title contains an accent such as the one in the French word hotel where it falls on the "o". I will try to type the word with the accent not knowing if it will show up on your computer screen, here goes: "hôtel". In this case the French word hotel with the accent ends up almost at the end of the column. I would like to have the titles in alphabetical order regardless of foreign accents, hence only taking into account ordinary spelling. Is there a way to make my JTable or TreeMap international? Thanks.
John de Michele
Joined: Mar 09, 2009
Sorting for String is in asciibetacal order. Since the codes for accented characters follow after all of the non-accented characters, they fall to the bottom. You should look into the java.text.Collator class and its subclass RuleBasedCollator.