Fixed that wathcing games did not work correctly.

This commit is contained in:
LevelX2 2016-02-28 10:52:55 +01:00
parent 996f07a4ff
commit 6d4a3bac28
3 changed files with 7 additions and 7 deletions

View file

@ -226,7 +226,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
}
public void sortLayout() {
if (battlefield == null) {
if (battlefield == null || this.getWidth() < 1) { // Can't do layout when panel is not sized yet
return;
}

View file

@ -608,9 +608,9 @@ public final class GamePanel extends javax.swing.JPanel {
}
}
PlayerView player = game.getPlayers().get(playerSeat);
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this,
new PlayAreaPanelOptions(game.isPlayer(), true, game.isRollbackTurnsAllowed()));
players.put(player.getPlayerId(), sessionPlayer);
PlayAreaPanel playAreaPanel = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this,
new PlayAreaPanelOptions(game.isPlayer(), game.isPlayer(), game.isRollbackTurnsAllowed()));
players.put(player.getPlayerId(), playAreaPanel);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.5;
@ -620,8 +620,8 @@ public final class GamePanel extends javax.swing.JPanel {
}
c.gridx = col;
c.gridy = row;
this.pnlBattlefield.add(sessionPlayer, c);
sessionPlayer.setVisible(true);
this.pnlBattlefield.add(playAreaPanel, c);
playAreaPanel.setVisible(true);
if (oddNumber) {
col++;
}

View file

@ -111,7 +111,7 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
@Override
public void actionPerformed(ActionEvent e) {
if (table.getRowCount() >= table.getEditingRow()) {
if (table.getRowCount() > 0 && table.getRowCount() >= table.getEditingRow()) {
int row = table.convertRowIndexToModel(table.getEditingRow());
fireEditingStopped();
ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);