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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:33:18+00:00 2026-06-04T06:33:18+00:00

I try create two moving object from one class. I want to control they

  • 0

I try create two moving object from one class. I want to control they but JApplet doesn’t open with threads.

My codes:

import java.awt.Graphics;
import javax.swing.JApplet;

class RunnableThread extends JApplet implements Runnable{

    Thread runner;
    String name;

    public RunnableThread(String namex){
        name=namex;
    }    

    public void init(){
        setSize(200,300);
    }

    public void paint(Graphics g){
        g.drawLine(20, 20, 50, 50);
    }

    public void run(){  
        System.out.println("test"+name);            
    }      
}


import java.util.logging.Level;
import java.util.logging.Logger;


public class RunnableTest{    
    public static void main(String args[]){
    RunnableThread bt1=new RunnableThread("test 1"); 
    RunnableThread bt2=new RunnableThread("test 2");     
    Thread btt1=new Thread(bt1);
    Thread btt2=new Thread(bt2);
    btt2.start();
    btt1.start();    
    } 
}
  • 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-04T06:33:19+00:00Added an answer on June 4, 2026 at 6:33 am

    You can’t run a JApplet through the main method. Before you try to do background threading in an applet (and this can be done), please first read the applet tutorials to see how to create and run applets.

    When you get your simple applets working and want to get back to this, don’t have your JApplet class implement Runnable but rather delegate that responsibility to another class.

    Please start here: Getting Started with Applets

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

Sidebar

Related Questions

I have created one table, but i want to create two and when i
I am currently trying to create two simple one-to-one mappings using Hibernate but somehow
I try to create a two level mux which contains two wide muxes. Each
I want to try create something like Zend's Server Pagecache. What I want to
I try to create a multi-threaded singleton pattern class. Header: class HL{ public: static
I get an error whenever I try to create a simple edge from a
I try to put the value of lastPointX into a label text, but doesn't
Where I try to create two static overloading methods I got an compilation error.
I want to use a configuration file to create two loggers which will log
I try to create a new file inside a JSP and try to save

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.