@@ -103,6 +103,8 @@ public class Game extends JPanel implements MouseListener, MouseMotionListener {
103103 private Color timerFontColor ;
104104 private Color openTerrainBoarderColor ;
105105 private Color counterDigitColor ;
106+ private Font timerFont ;
107+ private Font buttonFont ;
106108
107109
108110 // images
@@ -116,14 +118,17 @@ public Game(JFrame frame) {
116118
117119 // change the color if needed
118120
119- bgColor = new Color (234 , 242 , 255 ,(int ) (0.7 * 255 )); // 0.7 is the opacity
121+ bgColor = new Color (234 , 242 , 255 , (int ) (0.7 * 255 )); // 0.7 is the opacity
120122 openTerrainColor = new Color (255 , 255 , 255 , (int ) (0.5 * 255 ));
121123 openTerrainBoarderColor = new Color (0 , 0 , 0 , (int ) (0.5 * 255 ));
122124
123125 counterDigitColor = new Color (255 , 0 , 0 , (int ) (1.0 * 255 ));
124126
125127 footerColor = new Color (0 , 0 , 255 , (int ) (0.1 * 255 ));
126- timerFontColor = new Color (255 , 0 , 155 , (int ) (1.0 * 255 ));
128+ timerFontColor = new Color (0 , 0 , 0 , (int ) (1.0 * 255 ));
129+
130+ timerFont = new Font ("Arial" , Font .BOLD , 18 );
131+ buttonFont = new Font ("Arial" , Font .PLAIN , 12 );
127132
128133 // -------------------------
129134
@@ -215,6 +220,7 @@ private void loadImg() {
215220
216221 private void resetButton () {
217222 JButton result = new JButton ("Reset" );
223+ result .setFont (buttonFont );
218224 result .addActionListener (new ActionListener () {
219225 @ Override
220226 public void actionPerformed (ActionEvent e ) {
@@ -253,6 +259,7 @@ public void actionPerformed(ActionEvent e) {
253259 private void selectOpenTerrain () {
254260 // Create the reset button
255261 JButton result = new JButton ("<html>Open Terrain<br/><center><font size='2'>Cost: 1</font></center></html>" );
262+ result .setFont (buttonFont );
256263 result .addActionListener (new ActionListener () {
257264 @ Override
258265 public void actionPerformed (ActionEvent e ) {
@@ -269,6 +276,7 @@ public void actionPerformed(ActionEvent e) {
269276
270277 private void selectSwampland () {
271278 JButton result = new JButton ("<html>Swampland<br/><center><font size='2'>Cost: 4</font></center></html>" );
279+ result .setFont (buttonFont );
272280 result .addActionListener (new ActionListener () {
273281 @ Override
274282 public void actionPerformed (ActionEvent e ) {
@@ -285,6 +293,8 @@ public void actionPerformed(ActionEvent e) {
285293
286294 private void selectGrassland () {
287295 JButton result = new JButton ("<html>Grassland<br/><center><font size='2'>Cost: 3</font></center></html>" );
296+ result .setFont (buttonFont );
297+
288298 result .addActionListener (new ActionListener () {
289299 @ Override
290300 public void actionPerformed (ActionEvent e ) {
@@ -303,6 +313,8 @@ public void actionPerformed(ActionEvent e) {
303313 // search button to start the search algorithm
304314 private JButton searchButton () {
305315 JButton result = new JButton ("A* Search" );
316+ result .setFont (buttonFont );
317+
306318 result .addActionListener (new ActionListener () {
307319 @ Override
308320 public void actionPerformed (ActionEvent e ) {
@@ -344,6 +356,7 @@ private void resetCameFrom(Tile[][] tiles) {
344356
345357 private void selectGoalLocation () {
346358 JButton result = new JButton ("Goal" );
359+ result .setFont (buttonFont );
347360 result .addActionListener (new ActionListener () {
348361 @ Override
349362 public void actionPerformed (ActionEvent e ) {
@@ -360,6 +373,7 @@ public void actionPerformed(ActionEvent e) {
360373
361374 public void selectStartLocation () {
362375 JButton result = new JButton ("Start" );
376+ result .setFont (buttonFont );
363377 result .addActionListener (new ActionListener () {
364378 @ Override
365379 public void actionPerformed (ActionEvent e ) {
@@ -376,6 +390,7 @@ public void actionPerformed(ActionEvent e) {
376390
377391 public void selectObstacle () {
378392 JButton result = new JButton ("<html><center>Obstacle<br/><font size='2'>Cost: Impossible</font></center></html>" );
393+ result .setFont (buttonFont );
379394 result .addActionListener (new ActionListener () {
380395 @ Override
381396 public void actionPerformed (ActionEvent e ) {
@@ -728,7 +743,7 @@ private void printTimer(Graphics g) {
728743 timerX = frame .getWidth () - 620 ;
729744 timerY = frame .getHeight () - 47 ;
730745 g .setColor (timerFontColor ); // Sets the color to red.
731- g .setFont (new Font ( "Courier New" , Font . PLAIN , 20 ) );
746+ g .setFont (timerFont );
732747 g .drawString ("Creation Time: " + elapsedTimeStringBeforeSearch , timerX , timerY );
733748 g .setColor (Color .BLACK );
734749 g .drawString ("|" , timerX + 283 , timerY );
0 commit comments