Hi,

Someone has an idea if we can draw a line between two points with multiple colors i.e. some part of line is red and the rest part is green. Something like that.

Regards

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

You gotta write your own class for that.

Some elementary mathematics would help.

Imagine you have a line. It begins at (x1,y1) and ends and (x2,y2)

You just need a way to chop that line into bits and for each of those lines find the (x1,y1) and (x2,y2) coordinates changing the colour as you see fit.

You could also use Graphics2D and use a GradientPaint

Or you could just make three seprate lines in a row. Wouldn't that be crazy.

Member Avatar for iamthwee

Or you could just make three seprate lines in a row. Wouldn't that be crazy.

Nah my way is more complete.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.