Skip to content

Commit

Permalink
Se añade el metodo 'celdaConfig'.
Browse files Browse the repository at this point in the history
  • Loading branch information
X1lef committed Jul 30, 2017
1 parent 3d821cd commit 91f8c46
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/rompecabezas/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,7 @@ private JPanel panelDeTablero () {

for (int f = 0; f < 4; f ++) {
for (int c = 0; c < 4; c ++) {
celdas [f][c] = new JLabel("" + tablero [f][c], JLabel.CENTER);
celdas [f][c].setOpaque(true);
celdas [f][c].setBackground(Color.WHITE);
celdas [f][c].addMouseListener(controller);
celdas [f][c].setForeground(new Color(30, 30, 30));
celdas [f][c].setName(String.format("%d,%d", f, c));
celdas [f][c].setFont(new Font("Tahoma", Font.BOLD, 25));
celdas [f][c].setBorder(BorderFactory.createEtchedBorder());
celdas [f][c] = celdaConfig("" + tablero [f][c], String.format("%d,%d", f, c));

if (tablero [f][c] == VACIO)
celdas [f][c].setVisible(false);
Expand All @@ -120,6 +113,20 @@ private JPanel panelDeTablero () {
return panel;
}

private JLabel celdaConfig (String text, String name) {
JLabel label = new JLabel(text, JLabel.CENTER);
label.setOpaque(true);
label.setOpaque(true);
label.setBackground(Color.WHITE);
label.addMouseListener(controller);
label.setForeground(new Color(30, 30, 30));
label.setName(name);
label.setFont(new Font("Tahoma", Font.BOLD, 25));
label.setBorder(BorderFactory.createEtchedBorder());

return label;
}

boolean gano () {
int valor = 0;

Expand Down

0 comments on commit 91f8c46

Please sign in to comment.