Professional Documents
Culture Documents
NAME:-OMKAR BELE
ROLL NO:-205105
CLASS:-SYCS
TOPIC NAME:-EVEN AND ODD
NUMBER
SUBJECT NAME:-CORE JAVA
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:-
Constructor:-
Button b = new Button("Press");
Constructor:-
Label l=new Label();
PROGRAM:-
import java.io.*;
import java.awt.*;
import java.awt.event.*;
TextField tf1;
TextField tf2;
Label l1;
float a,b,c;
AWT_Event4()
tf1.setBounds(60,30,100,20);
b.setBounds(100,80,80,20);
b.addActionListener(this);
l1.setBounds(60,120,100,20);
add(l1);
add(b);
add(tf1);
setSize(300,300);
setLayout(null);
setVisible(true);
int n;
n=Integer.parseInt(tf1.getText().trim());
if (n%2==0)
l1.setText("Number is Even");
else
new AWT_Event4();
COMPLIE PROCESS:-
OUTPUT:-
OUTPUT:-
OUTPUT:-