Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:55:32+00:00 2026-06-04T10:55:32+00:00

I Have one rectangle. I wanted to do some animated stuff with colour on

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:55:33+00:00Added an answer on June 4, 2026 at 10:55 am

    To take out the borders of the rectangles with Graphics, you just don’t call the graphics function to draw. Example:

    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
    
        //Rectangle with Color_1
        g2.setColor(color1); //This would be red
        g2.fill(rect1);
    
        //Rectangle with Color_2
        g2.setColor(color2); //This would be green
        g2.fill(rect2);
    
               ... //Repeat for other rectangles
    
        g2.dispose()
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one function GetControlRectangle(Rectangle MethodRect) that accepts the rectangle of the control. Now
I have one two divs (rectangle) that have each the following transforms applied on:
I have one three rectangles in my canvas. I wanted to change the colours
I have one line (two point (x,y) (x1,y1)) and a rectangle with focus point
have one time consuming step that flattens a bunch of files. basically i'd like
I have one table that has sales records and another table that has additional
I have an application that gets one of its UI controls via an INativeHandleContract
I have one rectangle on top of another. They have sharp edges. I want
I have one grid that has 14 columns. If I place another grid of
I have one table having ID and other attributes. How can I get list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.