/**PROGRAM OF MOUSE HANDLING**/
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
class date1 extends Frame implements ActionListener,AdjustmentListener
{
Button a,b;
Label l1,l2,l3,l4;
TextField t1,t2,t3,t4;
Scrollbar s1,s2,s3;
String g1,g2,g3;
int da,mo,ye;
int z,x,y;
public date1()
{
a=new Button("OK");
b=new Button("EXIT");
l1=new Label("DD");
l2=new Label("MM");
l3=new Label("YY");
l4=new Label("DATE");
t1=new TextField(5);
t2=new TextField(10);
t3=new TextField(5);
t4=new TextField(20);
s1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1,31);
s2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1,12);
s3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1900,2100);
setLayout(new FlowLayout());
add(l1); add(s1); add(t1); add(l2); add(s2); add(t2);
add(l3); add(s3); add(t3);
add(a); add(l4); add(t4); add(b);
a.addActionListener(this);
b.addActionListener(this);
s1.addAdjustmentListener(this);
s2.addAdjustmentListener(this);
s3.addAdjustmentListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==a)
{
g1=t1.getText();
g2=t2.getText();
g3=t3.getText();
t4.setText(g1+"/"+g2+"/"+g3);
}
if(ae.getSource()==b)
{
System.exit(0);
}
}
public void adjustmentValueChanged(AdjustmentEvent be)
{
da=s1.getValue();
t1.setText(" "+da);
mo=s2.getValue();
t2.setText(" "+mo);
ye=s3.getValue();
t3.setText(" "+ye);
}
public static void main(String args[])throws Exception
{
date1 q=new date1();
q.setSize(400,400);
q.setVisible(true);
}
}
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
class date1 extends Frame implements ActionListener,AdjustmentListener
{
Button a,b;
Label l1,l2,l3,l4;
TextField t1,t2,t3,t4;
Scrollbar s1,s2,s3;
String g1,g2,g3;
int da,mo,ye;
int z,x,y;
public date1()
{
a=new Button("OK");
b=new Button("EXIT");
l1=new Label("DD");
l2=new Label("MM");
l3=new Label("YY");
l4=new Label("DATE");
t1=new TextField(5);
t2=new TextField(10);
t3=new TextField(5);
t4=new TextField(20);
s1=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1,31);
s2=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1,12);
s3=new Scrollbar(Scrollbar.HORIZONTAL,0,1,1900,2100);
setLayout(new FlowLayout());
add(l1); add(s1); add(t1); add(l2); add(s2); add(t2);
add(l3); add(s3); add(t3);
add(a); add(l4); add(t4); add(b);
a.addActionListener(this);
b.addActionListener(this);
s1.addAdjustmentListener(this);
s2.addAdjustmentListener(this);
s3.addAdjustmentListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==a)
{
g1=t1.getText();
g2=t2.getText();
g3=t3.getText();
t4.setText(g1+"/"+g2+"/"+g3);
}
if(ae.getSource()==b)
{
System.exit(0);
}
}
public void adjustmentValueChanged(AdjustmentEvent be)
{
da=s1.getValue();
t1.setText(" "+da);
mo=s2.getValue();
t2.setText(" "+mo);
ye=s3.getValue();
t3.setText(" "+ye);
}
public static void main(String args[])throws Exception
{
date1 q=new date1();
q.setSize(400,400);
q.setVisible(true);
}
}
No comments:
Post a Comment