-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton3.java
More file actions
48 lines (45 loc) · 1.09 KB
/
Copy pathbutton3.java
File metadata and controls
48 lines (45 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.awt.*;
import java.awt.event.*;
public class Button3 extends Frame implements ActionListener{
Button h,e,he,notany;
String msg="";
public Button3(){
h=new Button("HINDI");
e=new Button("ENGLISH");
he=new Button("HINDI+ENGLISH");
notany=new Button("NOT ANY");
h.setBounds(10,50,60,40);
e.setBounds(80,50,60,40);
he.setBounds(150,50,120,40);
notany.setBounds(280,50,60,40);
add(h);
add(e);
add(he);
add(notany);
e.addActionListener(this);
h.addActionListener(this);
he.addActionListener(this);
notany.addActionListener(this);
this.setLayout(null);
}
public void actionPerformed(ActionEvent ae){
String str=ae.getActionCommand();
msg = "We do not khow the language: "+str;
repaint();
}
public void paint(Graphics g){
Font f=new Font("Dialog",Font.BOLD,20);
g.setColor(Color.BLUE);
g.setFont(f);
g.drawString(msg,10,150);
}
public static void main(String args[]){
Button3 b2=new Button3();
b2.setSize(500,200);
b2.setVisible(true);
b2.setLayout(null);
b2.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);}});
}
}