I Have one rectangle. I wanted to do some animated stuff with colour on that.
That mean it should start filling with different colours in the rectangle.
It should start coming from left to right.
For example i have four colurs. Red green blue,orange.
so first 25% should be filled upwith red, next 25% with green, next 25% with blue, and remaining with
orange. First I tried to achieve the same result by using the rectangles on top of another rectangle.
so I could change the rectangles colour one by one. But the problem is, I could not remove the border for
those subrectanlge’s. That is the reason itwas visible as some kind of parts in the rectangle. It was showing
as if we divided the rectangle into four with colours. I dont want to show in that. I wanted to start applying
with different colours. Any Idea how do I do that. I am lacking logical things. We can say something progressbar with different colours.
I Have one rectangle. I wanted to do some animated stuff with colour on
Share
To take out the borders of the rectangles with
Graphics, you just don’t call the graphics function to draw. Example:Now the programmatic part would be trickier. You’d have to increase each rectangle separably.
Another way to do this would be to have a look at Color Blending. I don’t really know if that’s what you need but anyways:
http://www.java2s.com/Code/Java/2D-Graphics-GUI/Commoncolorutilities.htm
http://www.dbuggr.com/leothenerd/blend-rgb-color-function-java/
You’d obviously have to keep changing the colors with
g2.setColor(Color)and also keep changing the color itself to suit your need.