- * the new color
- */
- public void setColor(E id, Color color) {
- // Check for named colours first
- try {
- Field[] fields = Color.class.getFields();
- for (Field field : fields) {
- if (field.equals(color)) {
- setString(id, field.getName());
- return;
- }
- }
- } catch (Exception e) {
- }
- //
-
- String r = Integer.toString(color.getRed(), 16);
- String g = Integer.toString(color.getGreen(), 16);
- String b = Integer.toString(color.getBlue(), 16);
- String a = "";
- if (color.getAlpha() < 255) {
- a = Integer.toString(color.getAlpha(), 16);
+ * the new colour
+ */
+ public void setColor(E id, Integer color) {
+ int a = (color >> 24) & 0xFF;
+ int r = (color >> 16) & 0xFF;
+ int g = (color >> 8) & 0xFF;
+ int b = (color >> 0) & 0xFF;
+
+ String rs = Integer.toString(r, 16);
+ String gs = Integer.toString(g, 16);
+ String bs = Integer.toString(b, 16);
+ String as = "";
+ if (a < 255) {
+ as = Integer.toString(a, 16);