Hi im turning to you guys for two trivial questions, the first, I am drawing
a line using g.drawPolyline() how can I make each line a different colour,
the g.setColour() allows me to set the colour of the entire canvas as the
repaint method is required to show a newly drawn line ?
My second question is, how do I wrap an Array List as in place an entire
list into the first index of another array list or basic array, I presume it
needs to be wrapped but is there an easier way ?.
Hope that's semi clear, Thanks Pete
Andrew Thompson - 30 Mar 2004 00:35 GMT
> My second question is, how do I wrap an Array List as in place an entire
> list into the first index of another array list or basic array, I presume it
> needs to be wrapped but is there an easier way ?.
That has nothing to do with GUI's, try..
<http://www.physci.org/codes/javafaq.jsp#cljh>
OR, once you have learned what the
various groups are for, maybe..
<http://www.physci.org/codes/javafaq.jsp#cljp>
But no, stick with the former for the moment.

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Thomas Weidenfeller - 30 Mar 2004 07:48 GMT
> Hi im turning to you guys for two trivial questions, the first, I am drawing
> a line using g.drawPolyline() how can I make each line a different colour,
By drawing individual lines instead of a polyline.
> My second question is, how do I wrap an Array List as in place an entire
> list into the first index of another array list or basic array, I presume it
> needs to be wrapped but is there an easier way ?.
See a good textbook about Java, or comp.lang.java.help.
/Thomas
Babu Kalakrishnan - 30 Mar 2004 08:02 GMT
> Hi im turning to you guys for two trivial questions, the first, I am drawing
> a line using g.drawPolyline() how can I make each line a different colour,
> the g.setColour() allows me to set the colour of the entire canvas as the
> repaint method is required to show a newly drawn line ?
Obviously you cannot use the drawPolyLine method to achieve what you want.
Instead write your own method that does what you want and call it.
For instance :
private drawColoredPolyLine( Graphics g,
int[] xPoints,
int[]yPoints,
int nPoints,
Color[] colors)
{
for (int i=1; i < nPoints, i++)
{
g.setColor(colors[i-1]);
g.drawLine( xPoints[i-1],yPoints[i-1],
yPoints[i],yPoints[i]);
}
}
> My second question is, how do I wrap an Array List as in place an entire
> list into the first index of another array list or basic array, I presume it
> needs to be wrapped but is there an easier way ?.
That isn't very clear. Why do you need a special wrapping to do that ? An
ArrayList is an object, and I don't see any problem in adding it directly
to another ArrayList (or placing it into an Array of objects)
BK