Last change
on this file since 4 was 4, checked in by davidb, 16 years ago |
Starting source code to Expeditee
|
File size:
517 bytes
|
Line | |
---|
1 | package org.expeditee.gui;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 |
|
---|
5 | public class ColorUtils {
|
---|
6 |
|
---|
7 | public static Color getNextColor(Color color, Color[] wheel) {
|
---|
8 | // search through the colour wheel to find the next colour
|
---|
9 | int pos = -1;
|
---|
10 | for (int i = 0; i < wheel.length; i++)
|
---|
11 | if (color == null || color.equals(wheel[i])) {
|
---|
12 | pos = i;
|
---|
13 | break;
|
---|
14 | }
|
---|
15 | // if we didnt find the color on the wheel
|
---|
16 | if (pos < 0) {
|
---|
17 | return null;
|
---|
18 | } else {
|
---|
19 | pos++;
|
---|
20 | pos = pos % wheel.length;
|
---|
21 | color = wheel[pos];
|
---|
22 | }
|
---|
23 |
|
---|
24 | return color;
|
---|
25 | }
|
---|
26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.