Solved

Animation Using Constant Gif Strip

Posted on 1998-09-03
3
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

729 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