-
Notifications
You must be signed in to change notification settings - Fork 0
/
DadoGUI.java
62 lines (53 loc) · 1.83 KB
/
DadoGUI.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
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JButton;
/**
* Implementação gráfica do Dado.
*
* @author Alan Moraes / [email protected]
* @author Victor Koehler / [email protected]
*/
public class DadoGUI extends JButton {
private final Principal janelaPrincipal;
/**
* Construtor gráfico para os Dados.
*
* @param janelaPrincipal Janela principal.
*/
public DadoGUI(Principal janelaPrincipal) {
this.janelaPrincipal = janelaPrincipal;
initComponents();
setBackground(Color.WHITE);
setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
setIcon(janelaPrincipal.getIconePadrão("DADO_0"));
addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
janelaPrincipal.reagirDadoClicado((DadoGUI) evt.getSource());
}
});
}
/**
* Define o valor de exibição dos dados.
*
* @param valor Valor do dado
*/
public void setValor(int valor) {
if (valor >= 1 && valor <= 6) {
setIcon(janelaPrincipal.getIconePadrão("DADO_" + valor));
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated
// Code">//GEN-BEGIN:initComponents
private void initComponents() {
setMinimumSize(new java.awt.Dimension(150, 150));
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}