You are on page 1of 8

CORE JAVA PROJECT

CORE JAVa PROJECT

NAME:-OMKAR BELE

ROLL NO:-205105
CLASS:-SYCS
TOPIC NAME:-EVEN AND ODD
NUMBER
SUBJECT NAME:-CORE JAVA

Abstract Window Toolkit (AWT):-


The Abstract Window Toolkit (AWT) is Java's original
platform-dependent windowing, graphics, and user-interface widget
toolkit, preceding Swing. The AWT is part of the Java Foundation
Classes (JFC) — the standard API for providing a graphical user
interface (GUI) for a Java program. AWT is also the GUI toolkit for a
number of Java ME profiles. For example, Connected Device

KARMAVEER BHAURAO PATIL COLLEGEPage 1


CORE JAVA PROJECT

Configuration profiles require Javaruntimes on mobile telephones to


support the Abstract Window Toolkit.

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 are using the resources of OS.
The java.awt package provides classes for AWT api such
as TextField, Label, TextArea,
RadioButton, CheckBox, Choice, List etc.

The java.awt.event Package


The java.awt.event package defines classes and interfaces used for
  event handling in the AWT and Swing. The members of this package
fall into three categories:

Events:-
The classes with names ending in "Event" represent specific types of
events, generated by the AWT or by one of the AWT or Swing
components.
 

Listeners:-
The interfaces in this package are all event listeners; their names
end with "Listener". These interfaces define the methods that must
be implemented by any object that wants to be notified when a
particular event occurs. Note that there is a Listener interface for
each Event class.

Adapters:-

KARMAVEER BHAURAO PATIL COLLEGEPage 2


CORE JAVA PROJECT

Each of the classes with a name ending in "Adapter" provides a no-op


implementation for an event listener interface that defines more
than one method. When you are interested in only a single method
of an event listener interface, it is easier to subclass an Adapter class
than to implement all of the methods of the corresponding Listener
interface.

4).Java AWT Button:-


The button class is used to create a labeled button that has
platform independent implementation. The application
result in some action when the button is pushed.

AWT Button Class declaration:-


public class Button extends Component implements Accessible  

Constructor:-
Button b = new Button("Press");

2).Java AWT Label:-


The object of Label class is a component for placing text in a
container. It is used to display a single line of read only text.
The text can be changed by an application but a user cannot
edit it directly.

KARMAVEER BHAURAO PATIL COLLEGEPage 3


CORE JAVA PROJECT

AWT Label Class Declaration:-


public class Label extends Component implements Accessible  

Constructor:-
Label l=new Label();

Label l=new Label(“user name”)

3).Java AWT TextField:-


The object of a TextField class is a text component that
allows the editing of a single line text. It inherits
TextComponent class.

AWT TextField Class Declaration:-


public class TextField extends TextComponent
Constructor:-
TextFiled tx=new TextFiled();

TextField tx=new TextField(“ratan”);

PROGRAM:-
import java.io.*;

import java.awt.*;

import java.awt.event.*;

KARMAVEER BHAURAO PATIL COLLEGEPage 4


CORE JAVA PROJECT

public class AWT_Event4 extends Frame implements ActionListener

TextField tf1;

TextField tf2;

Label l1;

float a,b,c;

AWT_Event4()

tf1 = new TextField();

tf1.setBounds(60,30,100,20);

Button b = new Button("Press");

b.setBounds(100,80,80,20);

b.addActionListener(this);

l1= new Label(" ");

l1.setBounds(60,120,100,20);

add(l1);

add(b);

add(tf1);

setSize(300,300);

setLayout(null);

KARMAVEER BHAURAO PATIL COLLEGEPage 5


CORE JAVA PROJECT

setVisible(true);

public void actionPerformed(ActionEvent e)

int n;

n=Integer.parseInt(tf1.getText().trim());

if (n%2==0)

l1.setText("Number is Even");

else

l1.setText("Number is Odd ");

public static void main(String[] arg)

new AWT_Event4();

KARMAVEER BHAURAO PATIL COLLEGEPage 6


CORE JAVA PROJECT

COMPLIE PROCESS:-

OUTPUT:-

KARMAVEER BHAURAO PATIL COLLEGEPage 7


CORE JAVA PROJECT

OUTPUT:-

OUTPUT:-

KARMAVEER BHAURAO PATIL COLLEGEPage 8

You might also like