-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calculadora.java
63 lines (47 loc) · 1.26 KB
/
Calculadora.java
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Calculadora extends JFrame {
/**
* tela da calculadora
*/
JTextField tela = new JTextField();
public Calculadora(){
super("Calculadora");
Font f = new Font("serife",Font.PLAIN,32);
tela.setFont(f);
Container a = new JPanel();
a.setLayout(new GridLayout(4,4,5,5));
a.add(new JButton("7"));
a.add(new JButton("8"));
a.add(new JButton("9"));
a.add(new JButton("/"));
a.add(new JButton("4"));
a.add(new JButton("5"));
a.add(new JButton("6"));
a.add(new JButton("*"));
a.add(new JButton("1"));
a.add(new JButton("2"));
a.add(new JButton("3"));
a.add(new JButton("-"));
a.add(new JButton("0"));
a.add(new JButton("."));
a.add(new JButton("="));
a.add(new JButton("+"));
Container b = getContentPane();
b.setLayout(new BorderLayout());
b.add(BorderLayout.CENTER,a);
b.add(BorderLayout.NORTH,tela);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300,300);
setVisible(true);
}
public static void main(String[] args) {
new Calculadora();
}
}