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 8435935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:03:28+00:00 2026-06-10T07:03:28+00:00

I have a MyComposite class, where I want to animate the Size change. For

  • 0

I have a MyComposite class, where I want to animate the Size change.
For that I am changing the size in a loop.

After each loopteration I call layout().

Unfortunately the Composite doesnÄt repaint after each iteration, but jumps directly to the final size of my Composite.

How can I force the Widget to redraw on every size change?

MyComposite and Animation:



//start
new Animation().start(myComposite);

...

public MyComposite(Composite parent, int style, int bgcolor) {
        super(parent, style);
        this.setBackground(getDisplay().getSystemColor(bgcolor));       
    }

    @Override
    public Point computeSize(int wHint, int hHint, boolean changed) {
        return super.computeSize(width, height, changed);
    }


    class Animation{
        public void start(MyComposite composite){
            for(int i=0; i<1000; i++){
                composite.width++;
                composite.getParent().layout(true, true);
            }
        }
    }


MyComposite:

  • 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-10T07:03:30+00:00Added an answer on June 10, 2026 at 7:03 am

    The redrawing works as following:

    • layout() marks forces the repositioning of all composite-children. This will become visible on next repaint, which will be done somewhere in the future, when composite’s screen-area will be redrawn
    • redraw() marks the widget an invalidated. On next redraw-system-action this area will be repainted.
    • update() forces all outstanding redraw() requests to be completed NOW.

    So the problem was, that I did not trigger the repaint request to be done IMMEDIATELY.
    The correct animation function looks like:

    
    //layout of the composite doesn't work
    //composite.layout(true, true);
    
    //layout of parent works
    composite.getParent().layout(true, true);
    
    //marks the composite's screen are as invalidates, which will force a 
    composite.redraw(); redraw on next paint request 
    
    //tells the application to do all outstanding paint requests immediately
    composite.update(); 
    
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple form that has a PictureBox in one location. I want to
I have a JSF 2 composite component that employs some Ajax behavior. I want
Have a singleton class for BNRItemStore, but when I tried to call it, I
have written this little class, which generates a UUID every time an object of
Have such user_session model: class UserSession < Authlogic::Session::Base logout_on_timeout true # default if false
In my Composite WPF application I have an event that is published when the
I'm currently investigating the performance of a JSF application. I have noticed that code
Have written all the code in a silverlight class library (dll) and linked this
Have a problem that seems easy on paper but i'm having a big problem
I have the following input MyComposite[2.1], partition=default, mode=active, state=on, isDefault=true, deployedTime=2012-05-07T15:35:22.473-07:00 MessageManager[1.0], partition=default, mode=active,

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.