Skip to content
Snippets Groups Projects
Commit 01241ce0 authored by tcarver's avatar tcarver
Browse files

randomly select colours for lines

parent feb0d996
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ import java.awt.event.ActionListener; ...@@ -39,6 +39,7 @@ import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List; import java.util.List;
import java.util.Random;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
...@@ -154,10 +155,12 @@ public class LineAttributes ...@@ -154,10 +155,12 @@ public class LineAttributes
new Color(0,200,0), new Color(0,200,0),
Color.blue, Color.blue,
Color.magenta, Color.magenta,
new Color(204, 204, 51),
new Color(50, 255, 255), new Color(50, 255, 255),
Color.yellow, new Color(204, 51, 128),
new Color(255, 102, 0),
Color.black }; Color.black };
LineAttributes lines[] = new LineAttributes[numPlots]; final LineAttributes lines[] = new LineAttributes[numPlots];
if(numPlots == 1) if(numPlots == 1)
{ {
...@@ -165,12 +168,14 @@ public class LineAttributes ...@@ -165,12 +168,14 @@ public class LineAttributes
return lines; return lines;
} }
final Random rand = new Random();
for(int i=0; i<numPlots; i++) for(int i=0; i<numPlots; i++)
{ {
if(i < frameColour.length) if(i < frameColour.length)
lines[i] = new LineAttributes(frameColour[i]); lines[i] = new LineAttributes(frameColour[i]);
else else
lines[i] = new LineAttributes(Color.black); lines[i] = new LineAttributes(
new Color(rand.nextFloat(), rand.nextFloat(), rand.nextFloat()));
} }
return lines; return lines;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment