Browse Source

Requested change to darker colors

feature_TicTacToe_Playfield
kfkama 3 years ago
parent
commit
899ba9bbc4
  1. 4
      src/main/java/TicTacToe/Cell.java
  2. 3
      src/main/java/TicTacToe/Scoreboard.java
  3. 3
      src/main/java/TicTacToe/TicTacToeGame.java

4
src/main/java/TicTacToe/Cell.java

@ -15,7 +15,7 @@ public class Cell extends JButton {
public Cell(TicTacToeGame _ttt) { public Cell(TicTacToeGame _ttt) {
ttt = _ttt; ttt = _ttt;
setBackground(new Color(255, 255, 255));
setBackground(new Color(0));
addActionListener(new ActionListener() { addActionListener(new ActionListener() {
@Override @Override
@ -38,7 +38,7 @@ public class Cell extends JButton {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
g2.setPaint(Color.white);
switch (playerID) { switch (playerID) {
case 1: case 1:
g2.drawOval(5, 5, 90, 90); g2.drawOval(5, 5, 90, 90);

3
src/main/java/TicTacToe/Scoreboard.java

@ -1,5 +1,7 @@
package TicTacToe; package TicTacToe;
import java.awt.Color;
import javax.swing.JLabel; import javax.swing.JLabel;
public class Scoreboard extends JLabel{ public class Scoreboard extends JLabel{
@ -10,6 +12,7 @@ public class Scoreboard extends JLabel{
public Scoreboard(int _playerCount) { public Scoreboard(int _playerCount) {
playerPoints = new int[_playerCount]; playerPoints = new int[_playerCount];
setForeground(Color.white);
updateScores(); updateScores();
} }

3
src/main/java/TicTacToe/TicTacToeGame.java

@ -1,5 +1,6 @@
package TicTacToe; package TicTacToe;
import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.Line2D; import java.awt.geom.Line2D;
@ -23,6 +24,7 @@ public class TicTacToeGame extends JPanel {
public TicTacToeGame() { public TicTacToeGame() {
this.setSize(width, height); this.setSize(width, height);
setBackground(Color.black);
setLayout(null); setLayout(null);
initField(); initField();
initScoreboard(); initScoreboard();
@ -68,6 +70,7 @@ public class TicTacToeGame extends JPanel {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.white);
Line2D lin = new Line2D.Float(250, 150, 250, 450); Line2D lin = new Line2D.Float(250, 150, 250, 450);
Line2D lin2 = new Line2D.Float(350, 150, 350, 450); Line2D lin2 = new Line2D.Float(350, 150, 350, 450);

Loading…
Cancel
Save