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

randomly select colours for lines

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