Solved

Animation Using Constant Gif Strip

Posted on 1998-09-03
3
225 Views
Last Modified: 2008-03-06
What Is setbounds method in rectangle class ? what is the basic purpose of using it? How do we use threads for moving different graphics object?
0
Comment
Question by:vipin072998
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
diakov earned 50 total points
ID: 1223558
- r.setBounds() reshapes an existing Rectangle r object.
- For animation purposes of animation there some quite good examples. I paste a link. You have to apply some changes in order to customize it properly.
-------
http://java.sun.com/applets/applets/Animator/
0
 

Author Comment

by:vipin072998
ID: 1223559
You have not told me anything regarding threads handling using JAVA. i KNOW HOPW TO CREATE THREADS? But explainf me regarding when we create more than one thread in a single applet then where shall we define the code for different threads?
0
 
LVL 8

Expert Comment

by:diakov
ID: 1223560
You can create many threads the same two ways you create one. Well, then the codes differs a little bit.
If your threads inherit the Thread class, then you can create as many as you want just by calling the new operator, then object.start() and there they go.
If you implement the Runnable interface in a class (let say the applet itself) to make it have different thread then you have to do the following:
- in the constructor: c1 = new Thread(this); //where 'this' is a reference to the object (the applet) that implements the runnable interface and c1 is a variable where you store reference to the thread object in case you need it later. If you create many Threads you have to store in a vector or a hash table or several variables. The you call c1.start() in order to start the Thread execution. This means the run() method is called for the object implementing the Runnable (remember, you passed the this reference as an argument to the constructor of the thread) This run() will be called in a separate thread as many times as threads you got.
- Then in the run() method you do the following:
public void run()
{
  Thread temp = java.lang.Thread.currentThread();
  if (temp == c1)
  {
    //do the stuff thread c1 has to do
  }
  else if (temp == c2)
  {
    //do the stuff thread c2 has to do
  }
.
}
Cheers.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now