CHECK
BOX:
import java.awt.*;
import java.awt.event.*;
class
checkbox extends Frame implements ActionListener,ItemListener
{
Checkbox
x,y,z;
CheckboxGroup
a;
Button
b1;
public
checkbox()
{
b1=new
Button("EXIT");
setLayout(new
FlowLayout());
a=new
CheckboxGroup();
x=new
Checkbox("CSE");
y=new
Checkbox("IT");
z=new
Checkbox("ECE");
add(x);
add(y);
add(z);
add(b1);
x.addItemListener(this);
y.addItemListener(this);
z.addItemListener(this);
setLocation(100,100);
show();
b1.addActionListener(this);}
public
void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("EXIT"))
{
System.exit(1);
}}
public
void itemStateChanged(ItemEvent e)
{
System.out.println("CSE"+x.getState());
System.out.println("IT"+y.getState());
System.out.println("ECE"+z.getState());
}
public
static void main(String ar[])
{
checkbox
c=new checkbox();
}
}
CHOICE:
import
java.awt.*;
import
java.awt.event.*;
class
choice extends Frame implements ActionListener,ItemListener{
Button
b1;
Choice
c;
public
choice(){
b1=new
Button("EXIT");
c=new
Choice();
c.add("Green");
c.add("Red");
c.add("Blue");
c.add("Gray");
add(c);
add(b1);
b1.addActionListener(this);
c.addItemListener(this);}
public
void actionPerformed(ActionEvent e){
if(e.getActionCommand().equals("EXIT")){
System.exit(1);
}}
public
void itemStateChanged(ItemEvent b1)
{
if(c.getSelectedItem().equals("Green"))
{
setBackground(Color.green);
}
else
if(c.getSelectedItem().equals("Red"))
{
setBackground(Color.red);
}
else
if(c.getSelectedItem().equals("Blue")){
setBackground(Color.blue);}
else
if(c.getSelectedItem().equals("Gray")){
setBackground(Color.gray);
}}
public
static void main(String args[]){
choice
t=new choice();
t.setLayout(new
FlowLayout());
t.setSize(200,200);
t.setLocation(100,100);
t.show();
}}
LIST:
import java.awt.*;
import java.awt.event.*;
class
list extends Frame implements ActionListener
{
Button
b1;
public
list()
{
b1=new
Button("EXIT");
add(b1);
List
lst=new List(4,false);
lst.add("CSE");
lst.add("IT");
lst.add("ECE");
lst.add("EEE");
lst.add("CHEM");
add(lst);
b1.addActionListener(this);
}
public
void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("EXIT"))
{
System.exit(1);
}
}
public
static void main(String args[])
{
list
l=new list();
l.setLayout(new
FlowLayout());
l.setSize(400,200);
l.setLocation(100,100);
l.show();
}
}
CROLL:
import
java.awt.*;
import
java.awt.event.*;
class
Demo extends Frame implements ActionListener
{
Scrollbar
sc=new Scrollbar();
Button
b1;
public
Demo()
{
b1=new
Button("EXIT");
add(b1);
FlowLayout
f1=new FlowLayout();
setLayout(f1);
add(sc);
b1.addActionListener(this);
setSize(500,500);
show();
}
public
void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("EXIT"))
{
System.exit(1);
}
}
}
class
Scroll
{
public
static void main(String args[])
{
Demo
s=new Demo();
}
}
TEXT:
import java.awt.*;
import java.awt.event.*;
class
text extends Frame implements ActionListener
{
FlowLayout
f=new FlowLayout();
TextField
t1=new TextField(10);
TextField
t2=new TextField(10);
Button
b=new Button("COPY");
Button
b1=new Button("EXIT");
public
text()
{
setLayout(f);
setSize(600,400);
setLocation(200,200);
add(t1);
add(t2);
b.addActionListener(this);
add(b);
b1.addActionListener(this);
add(b1);
setVisible(true);
}
public
void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("COPY"))
{
t2.setText(t1.getText());
}
else
if(e.getActionCommand().equals("EXIT"))
{
System.exit(1);
}
}
public
static void main(String args[])
{
text
t1=new text();
}
}
BORDER LAYOUT:
import
java.awt.*;
class
border extends Frame
{
Button
b1= new Button("1");
Button
b2= new Button("2");
Button
b3= new Button("3");
Button
b4= new Button("4");
Button
b5= new Button("5");
border()
{
setLayout(new
BorderLayout());
add("North",b1);
add("South",b2);
add("East",b3);
add("West",b4);
add("Center",b5);
setSize(800,800);
}
public
static void main(String args[])
{
border
b1=new border();
b1.show();
}
}
ARD
LAYOUT:
import
java.awt.*;
class
ca extends Frame
{
CardLayout
c1;
Panel
p1;
Button
b1,b2,b3;
public
ca()
{
p1=new
Panel();
add(p1);
c1=new
CardLayout(50,50);
p1.setLayout(c1);
b1=new
Button("Button 1");
b2=new
Button("Button 2");
b3=new
Button("Button 3");
p1.add("Button
1",b1);
p1.add("Button
2",b2);
p1.add("Button
3",b3);
setSize(700,700);
setVisible(true);
}
public
boolean action(Event evt,Object obj)
{
c1.next(p1);
return
true;
}
public
static void main(String args[])
{
ca
c=new ca();
c.setVisible(true);
}
}
Output:
H:\iplab>javac
cardlayout.java
H
FLOW
LAYOUT:
import
java.awt.*;
import
java.awt.Frame.*;
class
flow extends Frame
{
Button
B1,B2;
public
flow()
{
B1=new
Button("Press");
B2=new
Button("Exit");
add(B1);
add(B2);
}
public
static void main(String args[])
{
flow
f=new flow();
f.setLayout(new
FlowLayout());
f.setSize(100,100);
f.setLocation(200,200);
f.setVisible(true);
System.out.println("Press
ctrl+c to quit");
}
}
GRID
LAYOUT:
import
java.awt.*;
class
Grid extends Frame
{
Button
b1=new Button("ONE");
Button
b2=new Button("TWO");
Button
b3=new Button("THREE");
public
Grid()
{
setLayout(new
GridLayout());
add(b1);
add(b2);
add(b3);
setSize(400,400);
}
public
static void main(String args[])
{
Grid
g=new Grid();
g.show();
}
}
GRIDBAG:
import
java.awt.*;
public
class Gridbag extends Frame
{
protected
void makebutton(String name,GridBagLayout gridbag,GridBagConstraints c)
{
Button
b=new Button(name);
gridbag.setConstraints(b,c);
add(b);
}
public
Gridbag()
{
GridBagLayout
g=new GridBagLayout();
GridBagConstraints
c=new GridBagConstraints();
setFont(new
Font("Helvetica",Font.PLAIN,14));
setLayout(g);
c.fill=GridBagConstraints.BOTH;
c.weightx=1.0;
makebutton("Button
1",g,c);
makebutton("Button
2",g,c);
makebutton("Button
3",g,c);
c.gridwidth=GridBagConstraints.REMAINDER;
makebutton("Button
4",g,c);
c.weightx=0.0;
makebutton("Button
5",g,c);
c.gridwidth=GridBagConstraints.RELATIVE;
makebutton("Button
6",g,c);
c.gridwidth=GridBagConstraints.REMAINDER;
makebutton("Button
7",g,c);
c.gridwidth=1;
c.gridwidth=2;
c.weighty=1.0;
makebutton("Button
8",g,c);
c.weighty=0.0;
c.gridwidth=GridBagConstraints.REMAINDER;
c.gridheight=1;
makebutton("Button
9",g,c);
}
public
static void main(String args[])
{
Gridbag
g1=new Gridbag();
g1.show();
}
}
Output:
COLOR PALETTE:
import
java.awt.*;
import
java.applet.*;
import
java.awt.event.*;
//<applet
code="color1.class" height=400 width=450></applet>
public
class color1 extends Applet implements ItemListener
{
int
currcolor=5;
int
flag=1;
String
text="check any of the button";
Button
buttons[]=new Button[5];
String
colors[]={"Red","Blue","Green","Yellow","Orange"};
Image
img;
CheckboxGroup
cbg=new CheckboxGroup();
Checkbox
box1=new Checkbox("Background Color",cbg,true);
Checkbox
box2=new Checkbox("Text Color" ,cbg,false);
Checkbox
box3=new Checkbox("Loading Image",cbg,false);
public
void init(){
for(int
i=0;i<5;i++){
buttons[i]=new
Button(" ");
add(buttons[i]);}
buttons[0].setBackground(Color.red);
buttons[1].setBackground(Color.blue);
buttons[2].setBackground(Color.green);
buttons[3].setBackground(Color.yellow);
buttons[4].setBackground(Color.orange);
add(box1);
add(box2);
add(box3);
box1.addItemListener(this);
box2.addItemListener(this);
box3.addItemListener(this);}
public
void itemStateChanged(ItemEvent e){
if(box1.getState()==true)
flag=1;
else
if(box2.getState()==true){
text="defalult
color is black";
flag=2;}
else
if(box3.getState()==true){
img=getImage(getDocumentBase(),"purple-flowers.jpg");
flag=3;}
repaint();}
public
void paint(Graphics g){
if(flag==2){
g.drawString(text,30,100);
switch(currcolor){
case
0:g.setColor(Color.red);
break;
case
1:g.setColor(Color.blue);
break;
case
2:g.setColor(Color.green);
break;
case
3:g.setColor(Color.yellow);
break;
case
4:g.setColor(Color.orange);
break;}
g.drawString(text,30,100);}
else
if(flag==1){
g.drawString(text,30,100);
switch(currcolor){
case
0:setBackground(Color.red);
break;
case
1:setBackground(Color.blue);
break;
case
2:setBackground(Color.green);
break;
case
3:setBackground(Color.yellow);
break;
case
4:setBackground(Color.orange);
break;}}
else
if(flag==3){
g.drawImage(img,20,90,this);}}
public
boolean action(Event e, Object o){
for(int
i=0;i<5;i++){
if(e.target==buttons[i]){
currcolor=i;
text="you
have chosen "+colors[i];
repaint();
return
true;}}
return
false;}}
Color1.html
<html>
<applet
code="color1.class" height=200 width=320>
</applet>
</html>
Output:
H:\iplab>javac
color1.java
H:\iplab>appletviewer color1.html PROGRAMS:
import java.net.*;
import java.io.*;
import java.util.Date;
class
ip
{
public
static void main(String[] arg)throws Exception
{
int
c;
URL
yahoo=new URL("http://localhost/a.html");
URLConnection
yahooCon=yahoo.openConnection();
System.out.println("Date:"+new
Date(yahooCon.getDate()));
System.out.println("content
type:"+yahooCon.getContentType());
System.out.println("Expires:"+yahooCon.getExpiration());
System.out.println("LastModified:"+new
Date(yahooCon.getLastModified()));
int
len=yahooCon.getContentLength();
System.out.println("Content
Length=33");
if(len>0)
{
System.out.println("------Content------");
InputStream
input=yahooCon.getInputStream();
int
i=len;
while(((c=input.read())!=-1)&&(--i>0))
{
System.out.print((char)c);
}
input.close();
}
}
}
PROGRAM
Server Side
import java.io.*;
import java.net.*;
class Server
{
public static
DatagramSocket serversocket;
public static
DatagramPacket dp;
public static
BufferedReader dis;
public static
InetAddress ia;
public static byte
buf[]=new byte[1024];
public static int
cport=789,sport=790;
public static void
main(String a[])throws IOException
{
serversocket=new DatagramSocket(sport);
dp=new
DatagramPacket(buf,buf.length);
dis=new
BufferedReader(new InputStreamReader(System.in));
ia=InetAddress.getLocalHost();
System.out.println("Server
is waiting for data from client");
while(true){
serversocket.receive(dp);
String s=new
String(dp.getData(),0,dp.getLength());
System.out.println(s);
}}}
Client Side
import java.io.*;
import java.net.*;
class Client{
public static
DatagramSocket clientsocket;
public static
BufferedReader dis;
public static
InetAddress ia;
public static byte
buf[]=new byte[1024];
public static int
cport=789,sport=790;
public static void
main(String a[])throws IOException{
clientsocket = new
DatagramSocket(cport);
dis=new
BufferedReader(new InputStreamReader(System.in));
ia=InetAddress.getLocalHost();
System.out.println("Client
is sending data to Server ");
while(true){
String
str=dis.readLine();
buf=str.getBytes();
clientsocket.send(new
DatagramPacket(buf,str.length(),ia,sport));
}}}
Output:
H:\iplab>javac
Server.java
H:\iplab>java Server
H:\iplab>javac
Client.java
H:\iplab>java Client
Servlet Code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
public class PostParam extends
GenericServlet
{
public void service(ServletRequest
request,ServletResponse response) throws ServletException,IOException
{
PrintWriter pw = response.getWriter();
Enumeration e =
request.getParameterNames();
while(e.hasMoreElements())
{
String pname = (String)e.nextElement();
pw.print(pname + " = ");
String pvalue = request.getParameter(pname);
pw.println(pvalue);
}
pw.close();
}}
HTML CODE:
<HTML>
<head>
<TITLE>INVOKING
SERVLET FROM HTML</TITLE>
</head>
<BODY>
<CENTER>
<FORM name = "PostParam"
method = "Post"
action="http://localhost:8080/servlets-examples/servlet/PostParam">
<TABLE>
<tr>
<td><B>Employee </B>
</td>
<td><input type =
"textbox" name="ename" size="25"
value=""></td>
</tr>
<tr>
<td><B>Phone </B>
</td>
<td><input type =
"textbox" name="phoneno" size="25"
value=""></td>
</tr>
</TABLE>
<INPUT type = "submit"
value="Submit">
</FORM>
</CENTER>
</body>
</html>
PROGRAMS:
MAIN.HTML:
<html>
<head>
<title><b>INTERNET
AND WORLD WIDE</b></title>
<center><title>INDIA
MAP</title></center>
</head>
<body>
<h1><b><marquee>WELCOME
TO INTERNET LAB</marquee></b></h1>
<body
bgcolor=yellow text=red>
<p>
<img
src="pic.bmp"="center"width="800"height="600"usemap="#INDIA ">
<map
name="INDIA ">
<area
shape="circle"ALT="CHENNAI"coords="250,200,10"HREF="chennai.html">
<area
shape="circle"ALT="MUMBAI"coords="160,170,10"HREF="mumbai.html">
<area
shape="circle"ALT="KOLKATTA"coords="270,140,20"HREF="kolkatta.html">
<area
shape="circle"ALT="DELHI "coords="170,100,20"HREF="delhi.html">
</map></p>
</body>
</html>
CHENNAI:
<html>
<head>
</head>
<body
bgcolor=red text=white>
<h1><marquee>WELCOME
TO MADRASAPATTINAM</marquee></h1>
<A
href="imagemap.html"><strong><FONT
color=white>homepage</FONT></strong></a><p></p>
<b><font
size=4 face=verdana>CHENNAI IS THE CAPITAL OF
TAMILNADU</font></b>
</body>
</html>
DELHI:
<html>
<head>
</head>
<body
bgcolor=red text=white>
<h1><marquee>WELCOME
TO NEWDELHI</marquee></h1>
<A
href="imagemap.html"><strong><FONT
color=white>homepage</FONT></strong></a><p></p>
<b><font
size=4 face=verdana>NEW DELHI IS THE CAPITAL OF INDIA</font></b>
</body>
</html>
KOLKATTA:
<html>
<head>
</head>
<body
bgcolor=red text=white>
<h1><marquee>WELCOME
TO KOLKATTA</marquee></h1>
<A
href="imagemap.html"><strong><FONT
color=white>homepage</FONT></strong></a><p></p>
<b><font
size=4 face=verdana>KOLKATTA IS THE BIRTHPLACE OF
GANGULY</font></b>
</body>
</html>
MUMBAI:
<html>
<head>
</head>
<body
bgcolor=red text=white>
<h1><marquee>WELCOME
TO MUMBAI</marquee></h1>
<A
href="imagemap.html"><strong><FONT
color=white>homepage</FONT></strong></a><p></p><b><font
size=4 face=verdana>AN IMPORTANT BUSINESS PLACE IN
INDIA</font></b>
</body>
</html>
ROGRAM:
home.html
<html>
<head>
<title>PRIST
UNIVERSITY</title>
<link
rel="stylesheet" href="D:\j2sdk1.4.1_01\main.css"
style="text/css">
</head>
<frameset
cols="15%,*" noresize="noresize" name="home">
<frame
name="link" src="link.html">
<frame
name="display" src="sit.html">
</frameset>
</html>
sit.html
<html>
<head>
<title>
PRIST UNIVERSITY </title>
<link
rel="stylesheet" href D:\j2sdk1.4.1_01\main.css "
type="text/css">
<style>
p.important{font-family:"Tahoma";
border:solid; border-width:thin; width:100%;color:blue} </style>
</head>
<body>
<marquee>
<h3>Welcome to PRIST UNIVERSITY </h3> </marquee>
<p><span
class=highlight>Prof.P.Murugesan</span> founded RICST(Ram Institute of
Computer Science & Technology) in 1985, way ahead of the IT-wave of the
90′s. This pioneering effort in the agricultural district of Thanjavur gained
quick recognition by its affiliation to the Bharathidasan University
in 1989 for PGDCA course.
<p>This
led to the establishment of Ponnaiyah Ramajayam College in 1994. Since it is
Managed by an academician, its PHILOSOPHYalong with its derivatives - VISION, MISSION and GOAL - were
predetermined under the umbrella of QUALITY and DISCIPLINE. Rest isHISTORY.</p>
<p><b>PHILOSOPHY</b>
<ul>To
receive the students in reverence.</ul>
<ul>To
educate them qualitatively.</ul>
<ul>To
inculcate in them a sense of self-discipline.</ul>
<ul>To
let them go forth with Virtues, Wisdom & Maturity.</ul>
<b>Vision</b>
</p>
<p>To
create an aptitude amongst the students towards education as a life long
process of formal and practical learning on the platform of assimilation of
experiences for ongoing knowledge and skill to be of value to oneself and
therefore to the society.</p>
<b>Mission</b>
<p>To
create and sustain an educational environment in which each student is taught
to believe in himself/herself, to create his/her own opportunities and to be a
team player so that he/she creates in himself/herself an unending thirst for
knowledge and skill.</p>
<b>Goal</b>
<p>To
encourage, nurture and develop inborn capabilities of each student into a
belief that nothing is impossible including permanent faith in positive
attitude to learning and effectively applying what is learnt, so that they are
prepared to make their career a successful one, their life a satisfying one and
contribute to the benefit of the society by their Virtues, Wisdom and
Maturity.</p>
<b>Quality
Commitment</b>
<ul>Inculcating
Discipline</ul>
<ul>Employing
Committed & skilled Personnel</ul>
<ul>Promoting
clear systems and procedures</ul>
<ul>Continuous
improvement in teaching skills</ul>
<ul>Continuous
upgrading in infrastructure</ul>
<ul>planned
Operation.</ul>
<p><span
class=underline><b>Growth of the
Institution:</b></span><br>
<ul>• 1986 Ram Institute of Computer Science &
Technology blossoms.</ul>
<ul>• 1994 Establishment of Ponnaiyah Ramajayam
College.</ul>
<ul>• 2000 Establishment of PR Engineering
College.</ul>
<ul>• 2003 Upgradation of Ponnaiyah Ramajayam
College as Research Institution.</ul>
<ul>• 2004 Establishment of Colleges of
Education.</ul>
<ul>• 2005 Establishment of Ponnaiyah Ramajayam
Polytechnic College, Thanjavur.</ul>
<ul>•
2005 DSIR Recognition for Ponnaiyah
Ramajayam College.</ul>
<ul>• 2006 Establishment of Ponnaiyah Ramajayam
College of Engineering & Technology.</ul>
<ul>• 2006 Establishment of Ponnaiyah Ramajayam
Polytechnic College, Kumbakonam.</ul>
<ul>• 2008 Deemed University status conferred for
PRIST.</ul>
<ul>• 2008
PRIST Chennai Campus blossoms.</ul>
<ul>• 2008 Establishment of Centre for Research
and Development in PRIST.</ul>
<ul>• 2008 Establishment of Centre for Distance
Education in PRIST.</ul>
<ul>• 2009 PRIST Campuses at Pondicherry,
Tiruchirappalli and Kumbakonam blossom.</ul>
<ul>• 2012 Establishment of PRIST – Madurai
Campus</ul>
</p></body>
</html>
link.html
<html>
<link
rel="stylesheet" href D:\j2sdk1.4.1_01\main.css ">
<body>
<ul>
<li><bullet><a
href="sit.html" target="display">Home
Page</a></bullet></li>
<li><a
href="department.html"
target="display">Departments</a></li>
<li><a
href="course.html"
target="display">Courses</a></li></ul>
</body>
</html>
main.css
BODY{FONT-SIZE:
1em;
MARGIN-LEFT:
5%;
COLOR:
#099669;
TEXT-INDENT:
3em;
MARGIN-RIGHT:
5%;
FONT-STYLE: italic;
FONT-FAMILY: verdana, sans serif}
H1{COLOR:
#000099;
FONT-FAMILY:
tahoma}
H2{COLOR:
#000099;
FONT-FAMILY: tahoma}
H3{
COLOR:
#000099;
FONT-FAMILY:
tahoma}
H4
{COLOR:
#000099;
FONT-FAMILY:
tahoma}
H5
{COLOR:
#000099;
FONT-FAMILY:
tahoma}
H6
{COLOR:
#000099;
FONT-FAMILY:
tahoma}
TH#1{
FONT-SIZE:
2em;
TEXT-TRANSFORM:
uppercase;
COLOR:
maroon;
FONT-FAMILY:
Arial, 'Arial Black', 'Arial Greek';
TEXT-ALIGN:
center}
SPAN.underline{
TEXT-DECORATION:
underline}
SPAN.highlight
{
COLOR:
white;
BACKGROUND-COLOR: transparent}
No comments:
Post a Comment