MISTAKES CORRECTION

MISTAKES CORRECTION

View Answers

August 24, 2008 at 8:25 PM

I used ur code which is as below but i did not got any error and applet got initilized:

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;

public class AppletSleep1 extends Applet implements Runnable {
Thread thread = null;
final static int width = 400;
final static int height = 300;
Image image;
Graphics graphics;
// bouncing lines member variables
int[] x1;
int[] y1;
int[] x2;
int[] y2;
int dx1 = 2 + (int)( 3 * Math.random());
int dy1 = 2 + (int)( 3 * Math.random());
int dx2 = 2 + (int)( 3 * Math.random());
int dy2 = 2 + (int)( 3 * Math.random());
static int first = 0;
final static int LINES = 50;
public void init() {

// create arrays to hold the line coordinates
x1 = new int[LINES];
y1 = new int[LINES];
x2 = new int[LINES];
y2 = new int[LINES];

// initialise the first line
x1[0] = (int)( WIDTH * Math.random() );
y1[0] = (int)( HEIGHT * Math.random() );
x2[0] = (int)( WIDTH * Math.random() );
y2[0] = (int)( HEIGHT * Math.random() );

// initialise all the other lines
for ( int i = 1; i < LINES; i++ ) {
x1[i] = x1[0];
y1[i] = y1[0];
x2[i] = x2[0];
y2[i] = y2[0];
}
image = createImage(width, height);
graphics = image.getGraphics();
}
public void start(){

// user visits the page, create a new thread
if(thread == null){
thread = new Thread( this );
thread.start();
}
}
public void stop() {
// user leaves the page, stop the thread
if(thread != null && thread.isAlive())
thread.stop();
thread = null;
}
public void run() {
while (thread != null) {
repaint();
try {
Thread.sleep(20);
}
catch(InterruptedException e ){
System.out.println(e);
}
}
}
public void paint(Graphics g) {
update(g);
}

public void update(Graphics g) {
// clear the background to white
graphics.setColor( Color.white );
graphics.fillRect( 0, 0, width, height );

// draw the lines
graphics.setColor( Color.red );
int line = first;
for ( int i = 0; i < LINES; i++ ) {
graphics.drawLine( x1[line], y1[line], x2[line], y2[line] );
line++;
if ( line == LINES ) line = 0;
}
line = first;
first--;
if ( first < 0 ) first = LINES - 1;
x1[first] = x1[line];
y1[first] = y1[line];
x2[first] = x2[line];
y2[first] = y2[line];

// copy buffer to screen
g.drawImage( image, 0, 0, this );
}
}









Related Tutorials/Questions & Answers:
MISTAKES CORRECTION - Java Beginners
MISTAKES CORRECTION  Dear Sir, As you Advised, without compiling, I run the programee with the undermentioned HTML codes in Internet.... Please correct my mistakes and help me please. Thanking you
MISTAKES CORRECTION - Java Beginners
MISTAKES CORRECTION   Dear Sir, The under mentioned Java Sleep programe was received through your favor. But when I compiled..., this ); } } Kindly help me to correct my mistakes
Advertisements
ModuleNotFoundError: No module named 'error-correction'
ModuleNotFoundError: No module named 'error-correction'  Hi, My... named 'error-correction' How to remove the ModuleNotFoundError: No module named 'error-correction' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'crosstalk-correction'
ModuleNotFoundError: No module named 'crosstalk-correction'  Hi...: No module named 'crosstalk-correction' How to remove the ModuleNotFoundError: No module named 'crosstalk-correction' error? Thanks   Hi
ModuleNotFoundError: No module named 'date-correction'
ModuleNotFoundError: No module named 'date-correction'  Hi, My... named 'date-correction' How to remove the ModuleNotFoundError: No module named 'date-correction' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'error-correction'
ModuleNotFoundError: No module named 'error-correction'  Hi, My... named 'error-correction' How to remove the ModuleNotFoundError: No module named 'error-correction' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'python-skew-correction'
ModuleNotFoundError: No module named 'python-skew-correction'  Hi...: No module named 'python-skew-correction' How to remove the ModuleNotFoundError: No module named 'python-skew-correction' error? Thanks   Hi
ModuleNotFoundError: No module named 'python-skew-correction'
ModuleNotFoundError: No module named 'python-skew-correction'  Hi...: No module named 'python-skew-correction' How to remove the ModuleNotFoundError: No module named 'python-skew-correction' error? Thanks   Hi
ModuleNotFoundError: No module named 'python-skew-correction'
ModuleNotFoundError: No module named 'python-skew-correction'  Hi...: No module named 'python-skew-correction' How to remove the ModuleNotFoundError: No module named 'python-skew-correction' error? Thanks   Hi
ModuleNotFoundError: No module named 'python-skew-correction'
ModuleNotFoundError: No module named 'python-skew-correction'  Hi...: No module named 'python-skew-correction' How to remove the ModuleNotFoundError: No module named 'python-skew-correction' error? Thanks   Hi
ModuleNotFoundError: No module named 'trytond-account-invoice-correction'
ModuleNotFoundError: No module named 'trytond-account-invoice-correction' ...: ModuleNotFoundError: No module named 'trytond-account-invoice-correction' How to remove the ModuleNotFoundError: No module named 'trytond-account-invoice-correction
Top 10 SEO Mistakes,Common Mistakes in Search Engine Optimization,Search Engine Marketing Mistakes
Search Engine Mistakes - Search Engine Optimization Mistakes... in the search engines are due to very simple mistakes in designing the web site... Exchange Mistakes You should always link exchange with good web site of the same kind
Mistakes To Be Avoided While Writing Articles
Mistakes To Be Avoided While Writing Articles   ... your website. 7 mistakes which must be avoided in order to make your article... or rewrite to the affiliate links. Avoid these 7 mistakes for increasing your
10 Common Web Design Mistakes
10 Common Web Design Mistakes Designing a website is the most crucial part... discussion on top 10 common web design mistakes we must understand the effectiveness of good design attributes and on the opposite side the mistakes that make
Top 10 Web Design Mistakes
Blaming the web design mistakes is a common behavior when a website faces... aspects is lost. There are many philosophies on classifying the web design mistakes but some mistakes are very common to have most disastrous effects
10 SEO Mistakes Most People Do
10 SEO Mistakes Most People Do Your excellence in making your SEO campaign... to how you avoid certain SEO mistakes most people do. These mistakes are sometimes... behind the failure of SEO campaign. Some of these mistakes are deliberate
i have created interface program for simple arithmetic operation but its show some error can i get reason and mistakes
i have created interface program for simple arithmetic operation but its show some error can i get reason and mistakes
GPS Map
GPS Map       The GPS Map 76 The GPSMAP- 76 is designed to provide precise GPS positioning using correction data obtained from the Wide Area Augmentation System
Common Interview Questions Page - 7
marks rather you may mention that if you had avoided certain mistakes, perhaps you
Various uses of Natural Language Processing Technology to Add Value In Our Life
with these unwanted mistakes with auto correction. The technology is being... and correct grammatical and sentence formation mistakes to auto-suggesting... to commit certain grammatical mistakes or to write wrongly framed sentences
Various uses of Natural Language Processing Technology to Add Value In Our Life
with these unwanted mistakes with auto correction. The technology is being... and correct grammatical and sentence formation mistakes to auto-suggesting... to commit certain grammatical mistakes or to write wrongly framed sentences
Various uses of Natural Language Processing Technology to Add Value In Our Life
at the rescue to deal with these unwanted mistakes with auto correction... and correct grammatical and sentence formation mistakes to auto-suggesting... for most of us to commit certain grammatical mistakes or to write wrongly
rEPLY - Java Beginners
rEPLY  hi, This is session code i am calling admin_home1.jsp then data will be not displaying its urgent requirement please send me correction Thanks   Hi friend, To display the session
SCJP Module-3 Question-7
of the inner class. 4. no need of correction. Answer :   Explanation : An inner
Molu - The Search Spider
with Related Term Suggestion and Spelling Correction Tool. Read full Description ADS
java
correction: System.out.println("No of items:"+tooa1Item); After the modification, if you
Advance Search in Servlet
. the string typed in is "With regards to the correction in pay" later on in the search
Advance Search in Servlet
. the string typed in is "With regards to the correction in pay" later on in the search
Advance Search in Servlet
. the string typed in is "With regards to the correction in pay" later on in the search
Advance Search in Servlet
. the string typed in is "With regards to the correction in pay" later on in the search
checking the data
typed in is "With regards to the correction in pay" later on in the search module
SCJP Module-9 Question-27
)". 2. No need of the correction. 3. By changing the value of the method
java
. Do correction: System.out.println("No of items:"+tooa1Item); After
java
of all your for statement is not correct. Do correction: for(double index=0.1;index
java
named count. 2)Do correction: System.out.println("No of items:"+tooa1Item); After
Techniques to Improve GPS Accuracy
to apply the necessary correction to their readings. This civilian system works... reference stations to calculate the required correction. The correction message... Augmentation System or LAAS uses similar correction data as WAAS. However LAAS uses
Dont Post Inner Adv and Adult Content Adv .
Inners Adv and Adult Content Adv . I hope you will not do the mistakes again
gettimeofday()
west of Greenwich dsttime - type of dst correction Example on gettimeofday
SCJP Module-4 Question-19
; } } How can we correct above code ? 1. no need for correction. 2
SCJP Module-6 Question-17
of correction 2. By changing "Exception" class to "Error"
SCJP Module-6 Question-19
. No need of correction 2. By adding 'static' to class at line number 1
SCJP Module-9 Question-26
? 1. No need of correction. 2. By replacing  " reverse(mylist)"
SCJP Module-12 Question-8
of correction 2. By adding "static float flt = 0;" before line 1 3
How to design a background, design a background, a background
to Filter menu > Blur >Apply Motion Blur. Lens correction: Go to Filter menu
What is WAAS?
the correction message. The correction takes into account the clock and orbit
JSF Date picker error - Java Server Faces Questions
if there any mistakes happened.and i saw one error in my tomcat console. That error
SCJP Module-4 Question-17
; method. 3. By increasing the number of arguments. 4. Correction is not needed
SCJP Module-4 Question-20
; calling book(2) from it at line 18 4. No correction needed. Answer: (1) ,(2
SCJP Module-6 Question-3
. No need for correction 4. by removing line 3 Answer : (1) Explanation

Ads