Outline of JAVA

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Outline of JAVA:

 Java is related to C++, which is a direct descendant of C.


 Much of the character of Java is inherited from these two languages.
 Java derives its syntax from C.
 Many of Java’s object-oriented features were influenced by C++.
 Java team members (also known as Green Team), initiated a revolutionary task to develop
a language for digital devices such as set-top boxes, televisions etc.
 For the green team members, it was an advance concept at that time. But it was suited for
internet programming. Later, Java technology as incorporated by Netscape.
 Currently, Java is used in internet programming, mobile devices, games, e-business
solutions etc. There are given the major points that describes the history of java.
 Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and
Mike Sheridan at Sun Microsystems, Inc. in 1991.
 Firstly, it was called "Greentalk" by James Gosling and file extension was .gt.
 After that, it was called Oak and was developed as a part of the Green project.
 This language was initially called “Oak,” but was renamed “Java” in 1995.

1.1 ABSTRACT WINDOW TOOLKIT (AWT)


 Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based
application in java.
 Java AWT components are platform-dependent i.e. components are displayed
according to the view of operating system.
 AWT is heavyweight i.e. its components uses the resources of system. The Abstract
Window Toolkit(AWT) support for applets.
 The AWT contains numerous classes and methods that allow you to create and manage
windows.
 The java.awt package provides classes for AWT API(Application Programming
Interface) such as TextField, Label, TextArea, RadioButton, CheckBox, Choice,
List etc.
Applet Initiation and Termination:.
 Every java applet inherit a set a default behavior from the Applet class. As the result
applet is loaded,it undergoes a series of changes in its state as shown in the above figure
the applet states will be
 Born or initialization state
 Running state
 Idle state
 Dead or destroyed state
Initialization State
 It is achieved by calling init() method of the applet class.
 We can perform the functions like
 Create objects needed by the applet
 Set up initial values
 Load images or fonts
 Setup colors
This method occurs only once
Syntax:
Public void init()
{
…..
}
Running state:

 Applet enter the running state when the system calls the start() method of the applet
class. This occurs automatically after the applet is initialized. Starting can also if the
applet is already in the idle stopped state. The start() method may be called by more
than one time.

Public void start()


{
………
}
Stopped Or Idle
 An applet becomes idle when it is stopped from running. Stopping occurs automatically
when we leave the page containing the currently running applet. We can also do
so by calling the stop() method explicitly. If we use the thread to run the applet that we
must use the stop() method to terminate the thread. We can achieve by overridding the
stop() method.
public void stop()
{
……
}

Dead State
 An applet is said to be dead when it is removed from the memory. This occurs
automatically by invoking the destroy() method. When we quit the browser. Like the
initialization destroying stage occur only once in the applet life cycle.
public void destroy()
{
.....
......
}
Display State
 Applet moves to the display state whenever it has to perform some output operation on
the screen. This happens immediately after the applet enters into the running state. The paint()
method is called to accomplish this task. Almost every applet will have a paint() method like
other method in the life cycle.

public void paint(Graphics s)


{
//ACTIONS
}
A simple applet program:

import java.applet.*; import java.awt.*;

public class sample Applet extends Applet


{
public void paint (Graphics g)
{
g.drawString ("Welcome", 25, 50);
}
}

You might also like