Browse Source

Added mouse listener to register click on matchfield

fleetstorm
Lorenz Hohmann 3 years ago
parent
commit
f36500d195
  1. 11
      src/main/java/de/tims/fleetstorm/gui/GUI.java

11
src/main/java/de/tims/fleetstorm/gui/GUI.java

@ -3,6 +3,8 @@ package de.tims.fleetstorm.gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.JFrame;
@ -170,6 +172,15 @@ public class GUI extends JPanel {
field.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
fields.add(field);
fieldWrapper.add(field);
field.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
field.setBackground(Color.RED);
field.revalidate();
field.repaint();
}
});
}
}

Loading…
Cancel
Save