Results 1 to 2 of 2
Thread: Applet Trouble
- 09-20-2011, 05:09 AM #1
Member
- Join Date
- Jul 2011
- Location
- New Delhi,India
- Posts
- 56
- Rep Power
- 0
Applet Trouble
i wrote this code:-
import java.applet.*;
import java.awt.*;
public class SimpleApplet1 extends Applet {
public void init(){
System.out.println("init");
}
public void start(){
System.out.println("start");
}
public void paint(Graphics g){
System.out.println("paint");
}
public void stop(){
System.out.println("stop");
}
public void destroy(){
System.out.println("destroy");
}
}
but whenever i start the execution of this program i get the output as-
init
start
paint
paint
this output is returned till i minimizes the applet window....
i am not able to understand why is the paint called twice when i starts the applet.....
thanks in advance...
- 09-20-2011, 06:14 AM #2
Re: Applet Trouble
1. Why are you using the old and largely obsolete AWT when you could be using the almost equally old but much more flexible Swing? Learning resource: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
2. You have no control over how many times and how often a painting method is called, so don't worry your head over it. Any component (not just an Applet) will be repainted whenever a need to do so is detected.
3. Except in certain very specific circumstances, any painting method override should invoke the super implementation.
db
Similar Threads
-
Java Applet starts then the applet field goes light blue
By oki in forum Java AppletsReplies: 30Last Post: 08-26-2011, 09:05 PM -
applet working in applet viewer, not browser
By plasticfood in forum Java AppletsReplies: 4Last Post: 06-24-2011, 06:47 PM -
Pass parameter from one applet to another applet in different webpages...
By anubhavranjan in forum Java AppletsReplies: 2Last Post: 09-29-2009, 03:33 PM -
Calling another applet on click of button in one applet
By niteshwar.bhardwaj in forum Java 2DReplies: 1Last Post: 02-19-2009, 12:54 PM -
Applet, To center text and To open I engage in a dialog in an Applet
By Marcus in forum Java AppletsReplies: 4Last Post: 06-08-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks