Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

INDEX

Sr. Title Page No .


1. Introduction
3. Data Flow Diagram
4. Use Case Diagram
5. Output
6. Conclusions
7. References
Introduction

Java is a programming language that produces software for multiple


platforms. When a programmer writes a Java application, the compiled
code (known as bytecode) runs on most operating systems (OS),
including Windows, Linux and Mac OS. Java derives much of its
syntax from the C and C++ programming languages. Java was
developed in the mid-1990s by James A. Gosling, a former computer
scientist with Sun Microsystems.

Java produces applets (browser-run programs), which facilitate


graphical user interface (GUI) and object interaction by Internet users.
Prior to Java applets, Web pages were typically static and non-
interactive. Java applets have diminished in popularity with the release
of competing products, such as Adobe Flash and Microsoft Silverlight.

Java applets run in a Web browser with Java Virtual Machine (JVM),
which translates Java bytecode into native processor instructions and
allows indirect OS or platform program execution. JVM provides the
majority of components needed to run bytecode, which is usually
smaller than executable programs written through other programming
languages. Bytecode cannot run if a system lacks required JVM.
Java program development requires a Java software development kit
(SDK) that typically includes a compiler, interpreter, documentation
generator and other tools used to produce a complete application.

Animation is a method in which pictures are manipulated to appear


as moving images. In traditional animation, images are drawn or
painted by hand on transparent celluloid sheets to be photographed and
exhibited on film. Today, most animations are made with Computer
Generated Imaginary (CGI). Computer animation can be very
detailed 3D animation, while 2D computer animation can be used for
stylistic reasons, low bandwidth or faster real-time renderings. Other
common animation methods apply a stop motion technique to two and
three-dimensional objects like paper cutouts, puppets or clay figures.

Commonly the effect of animation is achieved by a rapid succession of


sequential images that minimally differ from each other. The illusion—
as in motion pictures in general—is thought to rely on the phi
phenomenon and beta movement, but the exact causes are still
uncertain. Analog mechanical animation media that rely on the rapid
display of sequential images include the phénakisticope, zoetrope, flip
book, praxinoscope and film.

Television and video are popular electronic animation media that


originally were analog and now operate digitally. For display on the
computer, techniques like animated GIF and Flash animation were
developed.

These are the reasons why you should use packages in Java:

• Reusability: While developing a project in java, we often feel that


there are few things that we are writing again and again in our
code. Using packages, you can create such things in form of
classes inside a package and whenever you need to perform that
same task, just import that package and use the class.
• Better Organization: Again, in large java projects where we have
several hundreds of classes, it is always required to group the
similar types of classes in a meaningful package name.

Types of packages in Java


As mentioned in the beginning of this guide that we have two types of
packages
1) User defined package: The package we create is called user-defined
package.

2) Built-in package: The already defined package like java.io.*,


java.lang.* etc are known as built-in packages.

A Java method is a collection of statements that are grouped together


to perform an operation. When you call the
System.out.println() method, for example, the system actually
executes several statements in order to display a message on the
console.
Now you will learn how to create your own methods with or without
return values, invoke a method with or without parameters, and apply
method abstraction in the program design.
Data Flow diagram
Usecase Diagram
Program Code:
import java.awt.*;
import java.applet.*;
import java.util.*;
/*<applet code="MyApplet" width="500" height="500"></applet>*/
public class MyApplet extends Applet implements Runnable
{
Thread t,t1;
public void start()
{
t=new Thread(this);
t.start();
}

public void run()


{
t1=Thread.currentThread();
while(t1==t)
{
repaint();
try
{
t1.sleep(1000);
}
catch(InterruptedException e){}
}
}
public void paint(Graphics g)
{
Calendar cal =new GregorianCalendar();
String hour =String.valueOf(cal.get(Calendar.HOUR));
String minute =String.valueOf(cal.get(Calendar.MINUTE));
String second =String.valueOf(cal.get(Calendar.SECOND));
g.drawOval(90,85,160,160);
g.setColor(Color.BLACK);
g.fillOval(130,120,25,25);
g.fillOval(170,120,25,25);
g.drawArc(130,180,50,20,180,180);
g.setColor(Color.RED);
g.drawString(hour+" : "+ minute+" :" + second,135,170);
}
}

Output
Conclusion:

We successfully created animation of


digital clock and smiley face using
applet, graphics, multithreading.
References

https://www.google.com/

https://www.javatpoint.com/

https://www.geeksforgeeks.org/

You might also like