Java Applet in Hindi -
हैलो दोस्तों 🙏नमस्कार कैसे है आप सभी, मैं आशा करता हूँ की आप सभी अच्छे 😊 ही होंगे | तो दोस्तों मैं अनुज द्विवेदी आज आप सबके के लिये एक बार फिर से बहुत ही Important और Java से Related Applet के बारे में पोस्ट लेकर आया हूँ |तो दोस्तो Applet Java में लिखा गया एक छोटा Program होता है। यह बहुत हि lightweight होता है पोस्ट को अंत तक पढे और जानिये What is Applet in Java in Hindi और साथ में Applet Life Cycle in Hindi के बारे में जाने।
![]() |
What is Applet in Java in Hindi | Applet Life Cycle in Hindi |
What is Applet in Java in Hindi
Applets internet application के लिये एक small java program होते हैं और एक applet जो कि remote server पर located है उसको internet के माध्यम से download करके java capable or enable browser का प्रयोग करके local computer पर execute कराया जाता है ।Applet application program की तरह बहुत सारे operation जैसे- arithmetic operation, display graphics, play sounds accept user i/p, create animation औरinteractive games बना सकते हैं।
Applet को हम HTML document में in-build करते हैं और web-page के अंदर run करते हैं। Applet को run करना application create करने से ज्यादा complex होता है । Stand-alone program files को read और write कर सकते हैं लेकिन applet यह नही कर सकता है ।
Applets केवल web-browser के अंदर execute or run हो सकता हैं। Applet program को execute कराने के लिये हम Java enable browser का use करते हैं ।
Applet execution styles-
Applet को execute कराने के दो तरीके होते हैं -
- By HTML file
- by applet viewer tool
जब किसी system पर applet को run or test करने के लिये browser उपलब्ध नही होता है तो JDK हमे applet program को command prompt से execute कराने के लिये applet viewer tool provide करता है ।
Steps to test & Run applet program-
- Build-ing an applet code(.java file)
- Creating an executable applet (.class file)
- Designing a web page using HTML tags
- Preparing tag
- In corporating applet tag into web page
- Creating HTML file
- Testing the applet code
syntax-
import java.applet.Applet;
class A extends Applet
{
------------
------------
}
Applet life cycle-
1.init()-
init() method applet life cycle का first method होता है इस method में variable declarationobject creation और variables को initialize करना आदि कार्य किया जाता है । यह method applet के execute होने पर केवल एक बार call होता है ।
Syntax-
void init()
{
statement
}
2.start method()-
यह method init() method के बाद call होता है यह applet के stop होने के बाद भी पुन: applet को restart करने पर call होता है ।start() method applet को inactive से active state में लाता है । यह method browser में applet के restores, maximized या एक tab से दुसरे tab पर move होने पर start method execute होता है ।
Syntax-
void start()
{
statement
}
3. paint() method-
यह method java.awt.Graphics object को parameter के रुप में लेता हैं यह class applet windows में drawing करने के लिये method provide करता है । इस method में programmer applet code का main or code part लिखता है ।
Syntax-
void paint(Graphics g)
{
statement
}
Read these contents -
- CSE final Year Vidhya ?
- What is File System ?
- Directory Structure of Laravel in Hindi ?
- What is Network Security in Hindi ?
- What is Applet in Java in Hindi ?
- What is OOPs Concept In Hindi ?
- Laravel Installation in Windows ?
4. stop() method-
stop() method applet के execute को stop करता है । यहाँ applet temporary inactive हो जाती है । applet life cycle में यह method कई बार call होता है । जब applet को minimize or browser में एक tab से दुसरे tab में move करते है तब stop method execute होता है ।
Syntax-
void stop()
{
statement
}
5.destroy method-
destroy() method applet life cycle का सबसे last method होता है । जब applet windows को close किया जाता है तो destroy() method execute होता है । destroy() method memory से applet object को remove करता है ।
Syntax-
public void destroy()
{
statement
}
Notes-
1) जब applet execute होती है तब method execution sequence इस प्रकार होता है-
1) जब applet execute होती है तब method execution sequence इस प्रकार होता है-
- init()
- start()
- paint()
- stop()
- destroy()
Commonly use functions of Graphics class/main methods of Graphics class-
1)public void drawString(String str,int x,int y) - is used to draw specify string.2)public void drawRect(int x,int y,int width,int height) - draw a rectangle with the
specified width & height.
3)public void fillRect(int x,int y,int width,int height) - is used to fill rectangle with the default color and specified width and height.
Ex- g.setColor(Color.red);
g.fillRect(10,50,100,100);
4)public void drawOval(int x,int y,int width,int height) - is used to draw ovalwith the
specified width and height.
5)public void fillOval(int x,int y,int width,int height) - is used to fill oval with default
color and specified with width and height.
6)public void drawLine(int x1,int y1,int x2,int y2) - to draw line between the point(x1,y1)
and (x2,y2).
7)public boolean drawImage(Image img, int x,int y,ImageObserver observer) - is used to draw
specified image.
8)public boolean drawArc(int x,int y, int width, int height, int startangle, int arcangle) -
is used to draw a circular arc or elliptical arc.
9)public void setColor(Color c) - is used to set the graphics current color to specified
color.
10)public void setFont(Font f) - setFont("Arial",BOLD,20)
Final Word
तो दोस्तों आज मैंने आप को बताया की What is Applet in Java in Hindi है और Applet Life Cycle in Hindi क्या है|
तो दोस्तों मै आशा करता हूँ की आपको ये Post पसंद आई होगी। अगर आप को ये Post थोड़ी सी भी Useful/Helpful लगी हो Please Follow and Comment जरुर करे और इसे अपने दोस्तों के साथ Share करे! धन्यबाद|
Post a Comment
You are welcome to share your ideas with us in comments