-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplay.java
More file actions
33 lines (24 loc) · 865 Bytes
/
Display.java
File metadata and controls
33 lines (24 loc) · 865 Bytes
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
package br.com.pedro.calculadora;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JPanel;
import br.com.pedro.calculadora.modelo.Memoria;
import br.com.pedro.calculadora.modelo.MemoriaObservador;
public class Display extends JPanel implements MemoriaObservador{
private final JLabel label;
Display(){
Memoria.getInstancia().adicionarObservado(this);
setBackground(new Color(25, 25, 25));
label = new JLabel(Memoria.getInstancia().getTextoAtual());
label.setForeground(Color.WHITE);
label.setFont(new Font("SansSerif",Font.BOLD,28));
setLayout(new FlowLayout(FlowLayout.RIGHT,9,15));
add(label);
}
@Override
public void valorAlterador(String novoValor) {
label.setText(novoValor);
}
}