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

  • SEARCH
  • Home
  • 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 7929359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:02:56+00:00 2026-06-03T20:02:56+00:00

Image probe; Thread t; public int x=410,y=250; public void init() { //Images Call probe

  • 0
Image probe;

Thread t;
public int x=410,y=250;

public void init()
{
    //Images Call
    probe = getImage(getDocumentBase(),"image/probe.png");

    t = new Thread();   
}

public void paint(Graphics g)
{
    for(int i=0;i<5;i++)
    {
        g.drawImage(probe,x,y,50,50,this);
        g.setColor(Color.red);
        System.out.print(i);
        x=x+10;
        y=y+10;
        repaint();

        try
        {
            t.sleep(100);
        } catch(Exception e) {}
    }
}

So in this it should do my for loop 5 times correct? but instead it does it over and over and over and never stops when i want it to just move 5 times then stop, but instead it just goes on forever.

  • 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-03T20:02:57+00:00Added an answer on June 3, 2026 at 8:02 pm

    If your loop is in the paint() method and you call repaint() from within the loop you will cause the method to be called continually! You loop isn’t executing over and over, it’s executing once and then calling itself to be called again.

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

Sidebar

Related Questions

BACKGROUND-IMAGE: url(../images/feedback_trans_tab.png); _background-image: url(../images/feedback_tab_ie6.png) I've seen code like this in a css file feedback_tab_ie6.png
http://imageshack.us/photo/my-images/842/probx.png/ Sorry I don't have enough reputation to post an Image.. Above is a
Image Dummy = Image.FromFile(image.png); Dummy.Save(image.bmp, ImageFormat.Bmp); what the question says i have these using
image naturalWidth return zero... that's it, why ? var newimage = new Image(); newimage.src
public Image Base64ToImage(string base64String) { // Convert Base64 String to byte[] byte[] imageBytes =
Is it possible to display an image returned by jQuery AJAX call, in the
Image describing the problem http://img215.imageshack.us/img215/3725/20100314235127schedule2.jpg I hope the image above can explain what I
Image size is not the problem here, because my image is 800 Kb. My
Image on the left what I want, on the right what I keep getting.
My image is passed into my program from a server and saved as a

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.