Java Applet
Applet Communication
java.applet.AppletContext class provides the facility of communication between applets. We provide the name of applet through the HTML file. It provides getApplet() method that returns…
Parameter in Applet
We can get any information from the HTML file as a parameter. For this purpose, Applet class provides a method named getParameter(). Syntax: public String getParameter(String parameterName) Example…
Analog clock in Applet
Analog clock can be created by using the Math class. Let’s see the simple example: Example of Analog clock in Applet: import java.applet.*; import java.awt.*; import java.util.*; import java.text.*;…
Digital clock in Applet
Digital clock can be created by using the Calendar and SimpleDateFormat class. Let’s see the simple example: Example of Digital clock in Applet: import java.applet.*; import java.awt.*;…
Painting in Applet
We can perform painting operation in applet by the mouseDragged() method of MouseMotionListener. Example of Painting in Applet: import java.awt.*; import java.awt.event.*; import java.applet.*; public class MouseDrag extends Applet implements MouseMotionListener{ public void init(){ addMouseMotionListener(this); setBackground(Color.red);…
JApplet class
As we prefer Swing to AWT. Now we can use JApplet that can have all the controls of swing. The JApplet class extends the Applet…
EventHandling in Applet
As we perform event handling in AWT or Swing, we can perform it in applet also. Let’s see the simple example of event handling in…
Animation in Applet
Applet is mostly used in games and animation. For this purpose image is required to be moved. Example of animation in applet: import java.awt.*; import java.applet.*; public class AnimationExample extends Applet {…
Displaying Image in Applet
Applet is mostly used in games and animation. For this purpose image is required to be displayed. The java.awt.Graphics class provide a method drawImage() to…
Graphics in Applet
java.awt.Graphics class provides many methods for graphics programming. Commonly used methods of Graphics class: public abstract void drawString(String str, int x, int y): is used…