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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:49:21+00:00 2026-05-10T22:49:21+00:00

Of all these methods what’s being run and in what order?? I guess the

  • 0

Of all these methods what’s being run and in what order?? I guess the first question to ask is whats being run first?

And why does th.start() start run()?

import java.applet.*; import java.awt.*;  import javax.swing.JFrame;  public class BallApplet extends Applet implements Runnable {     int x_pos = 10;     int y_pos = 100;     int radius = 20;      private Image dbImage;     private Graphics dbG;      public void init() {         // setBackground(Color.BLUE);     }      public void start() {         Thread th = new Thread (this);         th.start();     }     public void stop() {}     public void destroy() {}      public void run() {         // 20 second delay per frame refresh (animation doesn't         // need to be perfectly continuous)              Thread.currentThread().setPriority(Thread.MIN_PRIORITY);          while (true) {             x_pos++;             repaint();             try {                 Thread.sleep(20);             }             catch (InterruptedException ex) {                 System.out.println('Caught!');             }             Thread.currentThread().setPriority(Thread.MAX_PRIORITY);         }     }     public void update(Graphics g) {         // implements double buffering         // drawing on doublebufferImage, note the dbG=dbImage.getGraphics(), so everything dbG.whatever() is         //      drawing on the Image's graphics which is later drawn with g.drawImage()          // initialize buffer         if (dbImage == null) {             dbImage = createImage (this.getSize().width, this.getSize().height);             dbG = dbImage.getGraphics();         }          // clear screen in background         dbG.setColor(getBackground());  // gets background color         dbG.fillRect(0, 0, this.getSize().width, this.getSize().height);          // draw elements in background         dbG.setColor(getForeground());         paint(dbG);          // draw image on the screen         g.drawImage(dbImage, 0, 0, this);      }     public void paint(Graphics g) {         g.setColor(Color.RED);         g.fillOval(x_pos-radius, y_pos-radius, 2*radius, 2*radius);     } } 
  • 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. 2026-05-10T22:49:21+00:00Added an answer on May 10, 2026 at 10:49 pm

    The init() and start() methods are invoked first.

    That in turn creates a Thread and starts that thread, which causes this class’s run() method to be invoked.

    The paint() method is invoked by Swing independently in the GUI event handling thread, if Swing detects that the applet needs to be redrawn.

    I note that the class’s main run() method also repeatedly calls repaint(). That explicitly tells the GUI thread to invoke update().

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer A library that I like a lot, and I'm seeing… May 11, 2026 at 11:28 am
  • added an answer .offset() will return the offset position of an element as… May 11, 2026 at 11:28 am
  • added an answer The smallest amount of data you can write at one… May 11, 2026 at 11:28 am

Related Questions

Of all these methods what's being run and in what order?? I guess the
Are there any implementations of all the nifty Selenium on Rails methods like wait_for_visible
Is there a way to print all methods of an object in JavaScript?
Is there a way to get all methods (private, privileged, or public) of a
Is there a method to get all of the .aspx files in my website?
Is there a built-in method in Python to get an array of all a
Is there a place to find all possible uses of the syscmd method in
Are all of these equal? Under what circumstances should I choose each over the
I have a class that creates several IDisposable objects, all of these objects are
I've used all three of these when making local programmatic connections to databases. Is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.