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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:51:54+00:00 2026-05-23T08:51:54+00:00

I am using 2 classes class1 and class2 , in java, both being in

  • 0

I am using 2 classes class1 and class2, in java, both being in different packages. class2 has a paintComponent() and a test() defined in it. I am calling these methods from class1 in the following sequence..

objclass2.repaint()
objclass2.test()
objclass2.repaint()

but I dont know why test() is executed first. repaint() is executed next.. plus the second repaint() is not executed as all.. Why is it so??

EDIT

for(int i=0;i<170;i++)
    {
        az.animate(i);
        try {
            Thread.sleep(160);
        } catch (InterruptedException ee) {
            ee.printStackTrace();
        }
    }

animate method():-

pd.setCurrentAltitudeScaleValue(val);
azl.update();
azl.repaint();

and in the azl.paintComponent() I am drawing a few things.. The animate method is being called every time the for loop executes but it doesnot call the repaint() again.. means repaint method is called only once though the animate() is called again and again..

  • 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-05-23T08:51:55+00:00Added an answer on May 23, 2026 at 8:51 am

    I assume you mean that paintComponent() is exhibiting the behaviour you mention. Bear in mind that:

    • when you call repaint(), that basically flags the component to say “this component needs re-painting at the next convenient moment from the event thread”
    • calls to paintComponent() can be coalesced.

    If the design of your program really relies on the order in which paintCompoent() is called, then I would suggest you choose a different design.

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

Sidebar

Related Questions

I have 2 different Java projects, one has 2 classes: dynamicbeans.DynamicBean2 and dynamic.Validator .
I am using java.util logging classes to create a rolling file appender. I want
Consider the following two Java classes: a.) class Test { void foo(Object foobar) {
I started using JNI to call Java classes from C++ some weeks ago and
Take these two Java classes: class User { final Inventory inventory; User (Inventory inv)
How would one create a Singleton class using PHP5 classes?
I am using System.Timers.Timer class in one of the classes in my application. I
I'm filling PDF applications using classes that represent the pdf. I have a property
How to add a FunctionImportMapping programmatically using classes from the System.Data.Entity.Design namespace? This blog
Can I reduce the textbox width without using classes? <input type=text maxlength=5 style=3px/>

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.