-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyFrame3.java
More file actions
45 lines (40 loc) · 1.02 KB
/
MyFrame3.java
File metadata and controls
45 lines (40 loc) · 1.02 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
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import java.lang.*;
import javax.swing.JFrame;
public class MyFrame3 extends Frame
{
JButton b1,b2;
MyActionListener ml;
MyFrame3()
{
setLayout(null);
ml = new MyActionListener(this);
JButton b1=new JButton("homepg");
b1.setBackground(Color. WHITE);
b1.setIcon(new ImageIcon(this.getClass().getResource("Images/abtushome.png")));
b1.setBounds(28,0,48,50);
add(b1);
b1.addActionListener(ml);
JButton b2 = new JButton("shut");
b2.setIcon(new ImageIcon(this.getClass().getResource("Images/abtusshut.png")));
b2.setBounds(1532,750,48,54);
add(b2);
b2.addActionListener(ml);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
}
public void paint(Graphics g)
{
Toolkit t=Toolkit.getDefaultToolkit();
Image i=t.getImage("Images/abtus.png");
g.drawImage(i, 0, 0,this);
}
}