-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhatever.java
More file actions
102 lines (76 loc) · 2.68 KB
/
Copy pathWhatever.java
File metadata and controls
102 lines (76 loc) · 2.68 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package game.GUI;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
public class Whatever {
private String[] itens;
private GridLayout grid;
private JInternalFrame janelaInterna;
private int linhas = 2;
private int colunas;
/* ARMAS */
private ImageIcon img;
private Image arma;
public Whatever(String []itens){
this.itens = itens;
colunas = itens.length;
gera();
}
/*
NOTA IMPORTANTE:
Usar as interfaces do swing por cima de um desenho do canvas/jpanel dá
um problema enorme e chato de resolver.
SUGESTÃO:
Faz a interface pintando ela ou renderizando sprites.
Se quiser faço as sprites mas não acho que seja preciso.
BY: Daniel
NOTA3: Fiz as sprites do zombie. Zombie comuna kKJkJKjKJKkKKJkJjJJ :B (vou fazer mais 2 ou 3 modelos de cor)
BELEUZA
*/
public void gera(){
grid = new GridLayout(linhas,colunas);
janelaInterna = new JInternalFrame("Vamos as compras");
janelaInterna.setSize(colunas * 100, linhas * 100); //quadrados de 100 x 100, saporra não funciona
//janelaInterna.getContentPane().setBackground(Color.WHITE);
janelaInterna.setVisible(true);
janelaInterna.setLayout(grid);
//janelaInterna.add(new JLabel(new ImageIcon(pistola)));
/*
for(int i = 0; i < colunas; i++){
janelaInterna.add(new JLabel(itens[i]));
}
*/
for(int i = 0; i < colunas; i++){
img = new ImageIcon(getClass().getResource(itens[0] + ".png"));
arma = img.getImage().getScaledInstance(70, 70, 0);
janelaInterna.add(new JLabel(new ImageIcon(arma)));
}
for(int i = 0; i < colunas; i++)
janelaInterna.add(new JButton("Comprar"));
}
public JInternalFrame getJanelaInterna(){
return janelaInterna;
}
/*
public static void main(String[] args) {
String []vetor = new String[4];
vetor[0] = "pistola";
vetor[1] = "m4";
vetor[2] = "ak";
vetor[3] = "bazuca"; // Q isso! O.O By: Daniel
JFrame janela = new JFrame("TESTE");
janela.setSize(400, 200); //aaaaaa
janela.setLocationRelativeTo(null);
janela.setDefaultCloseOperation(EXIT_ON_CLOSE);
janela.setVisible(true);
CompraItens ci = new CompraItens(vetor);
janela.add(ci.getJanelaInterna());
}
//*/
}