Index: trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 9394)
+++ trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 9395)
@@ -12,4 +12,5 @@
 import java.awt.Stroke;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -106,5 +107,13 @@
      */
     public enum ColorMode {
-        NONE, VELOCITY, HDOP, DIRECTION, TIME
+        NONE, VELOCITY, HDOP, DIRECTION, TIME;
+
+        static ColorMode fromIndex(final int index) {
+            return values()[index];
+        }
+
+        int toIndex() {
+            return Arrays.asList(values()).indexOf(this);
+        }
     }
 
@@ -141,5 +150,5 @@
         try {
             int i = Main.pref.getInteger("draw.rawgps.colors", specName(layerName), 0);
-            return ColorMode.values()[i];
+            return ColorMode.fromIndex(i);
         } catch (Exception e) {
             Main.warn(e);
