Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Applets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Applets
Applets init()
ml behra
Greenhorn
Posts: 8
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi everybody!!!
In a
applet
we have init() method and it is invoked when the applet is first loaded.Can we invoke the constructor of the class before init().if so how?
thanks in advance.
Grant Crofton
Ranch Hand
Posts: 154
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I don't think applet's use constructors io the same way as normal - init() IS the applet's constructor.
Stephanie Grasson
Ranch Hand
Posts: 347
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I believe you need to make the constuctor for your applet public.
A little example is included below:
import java.applet.*; import java.awt.*; public class ConstructApplet extends Applet { String theString; public ConstructApplet() { theString = new String("Inside constructor"); } public void init() { theString += ", inside init()"; } public void paint(Graphics g) { g.drawString(theString, 10, 10); } }
Hope this helps.
Stephanie
ml behra
Greenhorn
Posts: 8
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks stephanie for ur reply.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Q.64 from John Hunt
quick question about Frame
why dose applets have init method and applications dont
calling start() on broken init()
From Applet to Stand-Alone
More...