Skip to content

Commit e82298f

Browse files
committed
Bug fixed in GraphicalBoard and small change in server selection page.
1 parent 442e955 commit e82298f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

swing/src/spaghetti/gui/swing/GraphicalBoard.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void paintComponent(Graphics g) {
166166
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
167167
g2.setFont(font);
168168
g2.setColor(parent.colorPalette.get(0));
169-
g2.drawString(msg, 50, 50);
169+
g2.drawString(msg, 50, 50 + charHeight);
170170
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
171171
}
172172

@@ -312,14 +312,14 @@ protected void drawTile(Graphics2D g2, int row, int col) {
312312
int x0 = x + gridLineWidth, y0 = y + gridLineWidth, s = tileSize - gridLineWidth * 2;
313313

314314
Point p = new Point(row, col);
315-
if (p.equals(highlight)) {
315+
if (type != '\0') {
316+
drawTileType(g2, type, x0, y0, s, color0, color1, parent.colorPalette.get(-1));
317+
} else if (p.equals(highlight)) {
316318
g2.setColor(parent.colorPalette.get(6));
317319
g2.fillRect(x, y, s + gridLineWidth * 2, s + gridLineWidth * 2);
318320
} else if (sample != null && p.equals(getBoardPosition(sample.x, sample.y))) {
319321
g2.setColor(parent.colorPalette.get(board.getTurn()? 4: 3));
320322
g2.fillRect(x, y, s + gridLineWidth * 2, s + gridLineWidth * 2);
321-
} else {
322-
drawTileType(g2, type, x0, y0, s, color0, color1, parent.colorPalette.get(-1));
323323
}
324324

325325
g2.setStroke(new BasicStroke(gridLineWidth));
@@ -428,8 +428,6 @@ public void mouseDragged(MouseEvent e) {
428428
@Override
429429
public void mouseMoved(MouseEvent e) {
430430
if (!isBoardRunning()) {
431-
sample = null;
432-
highlight = null;
433431
return;
434432
}
435433
if (inSample(e.getPoint())) {

swing/src/spaghetti/gui/swing/PlayerSelection.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public void itemStateChanged(ItemEvent e) {
239239
setLayout(layouts[typeSelection.getSelectedIndex()]);
240240
typeSelection.setVisible(true);
241241
nameField.setVisible(true);
242+
nameField.setEnabled(true);
242243
nameLabel.setVisible(true);
243244
title.setVisible(true);
244245
switch (typeSelection.getSelectedIndex()) {
@@ -248,6 +249,7 @@ public void itemStateChanged(ItemEvent e) {
248249

249250
serverPortLabel.setVisible(true);
250251
serverPortField.setVisible(true);
252+
nameField.setEnabled(false);
251253
break;
252254
case 2:
253255
execFileLabel.setVisible(true);

0 commit comments

Comments
 (0)