Continued side panel
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@499 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
fcf33eb280
commit
ace7175f1a
7 changed files with 120 additions and 39 deletions
|
@ -1,6 +1,9 @@
|
||||||
package jrummikub.view;
|
package jrummikub.view;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import jrummikub.model.GameSettings;
|
import jrummikub.model.GameSettings;
|
||||||
|
import jrummikub.model.IPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock class for the side panel
|
* Mock class for the side panel
|
||||||
|
@ -24,5 +27,11 @@ public class MockSidePanel implements ISidePanel {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayers(List<IPlayer> players)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ public abstract class AbstractSettingsControl {
|
||||||
* Create a new settings control
|
* Create a new settings control
|
||||||
*
|
*
|
||||||
* @param view
|
* @param view
|
||||||
* the view to use
|
* the view to use
|
||||||
* @param settings
|
* @param settings
|
||||||
* initial game settings
|
* initial game settings
|
||||||
*/
|
*/
|
||||||
protected AbstractSettingsControl(IView view, GameSettings settings) {
|
protected AbstractSettingsControl(IView view, GameSettings settings) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
@ -43,8 +43,10 @@ public abstract class AbstractSettingsControl {
|
||||||
|
|
||||||
view.getSettingsPanel().setPlayerNamesEditable(
|
view.getSettingsPanel().setPlayerNamesEditable(
|
||||||
Collections.<Boolean> emptyList());
|
Collections.<Boolean> emptyList());
|
||||||
view.getSettingsPanel().setPlayerColors(
|
view.getSettingsPanel()
|
||||||
new HashSet<Color>(Arrays.asList(ISettingsPanel.PLAYER_COLORS)));
|
.setPlayerColors(
|
||||||
|
new HashSet<Color>(Arrays
|
||||||
|
.asList(ISettingsPanel.PLAYER_COLORS)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addListeners() {
|
protected void addListeners() {
|
||||||
|
@ -95,7 +97,8 @@ public abstract class AbstractSettingsControl {
|
||||||
|
|
||||||
private void addOptionListeners1() {
|
private void addOptionListeners1() {
|
||||||
connections.add(view.getSettingsPanel()
|
connections.add(view.getSettingsPanel()
|
||||||
.getChangeInitialMeldThresholdEvent().add(new IListener1<Integer>() {
|
.getChangeInitialMeldThresholdEvent()
|
||||||
|
.add(new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer value) {
|
public void handle(Integer value) {
|
||||||
settings.setInitialMeldThreshold(value);
|
settings.setInitialMeldThreshold(value);
|
||||||
|
@ -120,7 +123,8 @@ public abstract class AbstractSettingsControl {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
connections.add(view.getSettingsPanel().getChangeNumberOfStonesDealtEvent()
|
connections.add(view.getSettingsPanel()
|
||||||
|
.getChangeNumberOfStonesDealtEvent()
|
||||||
.add(new IListener1<Integer>() {
|
.add(new IListener1<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Integer value) {
|
public void handle(Integer value) {
|
||||||
|
@ -278,8 +282,9 @@ public abstract class AbstractSettingsControl {
|
||||||
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
|
for (int j = i + 1; j < settings.getPlayerList().size(); ++j) {
|
||||||
PlayerSettings player2 = settings.getPlayerList().get(j);
|
PlayerSettings player2 = settings.getPlayerList().get(j);
|
||||||
if (player2.getName().equals(name) && player2.getType() == type) {
|
if (player2.getName().equals(name) && player2.getType() == type) {
|
||||||
view.getSettingsPanel().setError(
|
view.getSettingsPanel()
|
||||||
ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
|
.setError(
|
||||||
|
ISettingsPanel.SettingsError.DUPLICATE_PLAYER_NAME_ERROR);
|
||||||
view.getSettingsPanel().enableStartGameButton(false);
|
view.getSettingsPanel().enableStartGameButton(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -291,8 +296,7 @@ public abstract class AbstractSettingsControl {
|
||||||
private boolean checkErrors() {
|
private boolean checkErrors() {
|
||||||
int totalStonesDealt = settings.getNumberOfStonesDealt()
|
int totalStonesDealt = settings.getNumberOfStonesDealt()
|
||||||
* settings.getPlayerList().size();
|
* settings.getPlayerList().size();
|
||||||
int totalStones = settings.getHighestValue() * settings.getStoneSetNumber()
|
int totalStones = settings.getTotalStones();
|
||||||
* settings.getStoneColors().size() + settings.getJokerNumber();
|
|
||||||
|
|
||||||
if (totalStones <= totalStonesDealt) {
|
if (totalStones <= totalStonesDealt) {
|
||||||
view.getSettingsPanel().setError(
|
view.getSettingsPanel().setError(
|
||||||
|
|
|
@ -97,7 +97,6 @@ public class GameControl {
|
||||||
* Game gets started by initializing the first Round
|
* Game gets started by initializing the first Round
|
||||||
*/
|
*/
|
||||||
public void startGame() {
|
public void startGame() {
|
||||||
view.getSidePanel().setGameSettings(gameSettings);
|
|
||||||
view.showSidePanel(true);
|
view.showSidePanel(true);
|
||||||
startRound();
|
startRound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import jrummikub.model.IHand;
|
||||||
import jrummikub.model.IPlayer;
|
import jrummikub.model.IPlayer;
|
||||||
import jrummikub.model.IRoundState;
|
import jrummikub.model.IRoundState;
|
||||||
import jrummikub.model.ITable;
|
import jrummikub.model.ITable;
|
||||||
|
import jrummikub.model.Player;
|
||||||
import jrummikub.model.PlayerSettings;
|
import jrummikub.model.PlayerSettings;
|
||||||
import jrummikub.model.Position;
|
import jrummikub.model.Position;
|
||||||
import jrummikub.model.Score;
|
import jrummikub.model.Score;
|
||||||
|
@ -92,6 +93,7 @@ public class RoundControl {
|
||||||
* Continue a saved round after loading
|
* Continue a saved round after loading
|
||||||
*/
|
*/
|
||||||
public void continueRound() {
|
public void continueRound() {
|
||||||
|
|
||||||
connections.add(view.getStartTurnEvent().add(new IListener() {
|
connections.add(view.getStartTurnEvent().add(new IListener() {
|
||||||
@Override
|
@Override
|
||||||
public void handle() {
|
public void handle() {
|
||||||
|
@ -141,6 +143,8 @@ public class RoundControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doPrepareTurn() {
|
protected void doPrepareTurn() {
|
||||||
|
updateSidePanel();
|
||||||
|
|
||||||
boolean isHuman = roundState.getActivePlayer().getPlayerSettings()
|
boolean isHuman = roundState.getActivePlayer().getPlayerSettings()
|
||||||
.getType() == HUMAN;
|
.getType() == HUMAN;
|
||||||
boolean oneHuman = roundState.getGameSettings().oneHuman();
|
boolean oneHuman = roundState.getGameSettings().oneHuman();
|
||||||
|
@ -207,6 +211,18 @@ public class RoundControl {
|
||||||
|
|
||||||
turnControl.startTurn();
|
turnControl.startTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSidePanel() {
|
||||||
|
view.showSidePanel(true);
|
||||||
|
view.getSidePanel().setGameSettings(roundState.getGameSettings());
|
||||||
|
List<IPlayer> players = new ArrayList<IPlayer>();
|
||||||
|
for (int i = 1; i < roundState.getPlayerCount(); i ++) {
|
||||||
|
players.add(roundState.getNthNextPlayer(-i));
|
||||||
|
}
|
||||||
|
view.getSidePanel().setPlayers(players);
|
||||||
|
view.getSidePanel().setHeapCapacity(roundState.getGameSettings().getTotalStones());
|
||||||
|
view.getSidePanel().setHeapSize(roundState.getGameHeap().getSize());
|
||||||
|
}
|
||||||
|
|
||||||
/** Override this */
|
/** Override this */
|
||||||
protected void addTurnControlListeners(ITurnControl turnControl) {
|
protected void addTurnControlListeners(ITurnControl turnControl) {
|
||||||
|
@ -217,14 +233,12 @@ public class RoundControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void deal() {
|
void deal() {
|
||||||
view.getSidePanel().setHeapCapacity(roundState.getGameHeap().getSize());
|
|
||||||
for (int i = 0; i < roundState.getPlayerCount(); i++) {
|
for (int i = 0; i < roundState.getPlayerCount(); i++) {
|
||||||
IHand hand = roundState.getNthNextPlayer(i).getHand();
|
IHand hand = roundState.getNthNextPlayer(i).getHand();
|
||||||
for (int j = 0; j < roundState.getGameSettings().getNumberOfStonesDealt(); j++) {
|
for (int j = 0; j < roundState.getGameSettings().getNumberOfStonesDealt(); j++) {
|
||||||
hand.drop(roundState.getGameHeap().drawStone(), new Position(0, 0));
|
hand.drop(roundState.getGameHeap().drawStone(), new Position(0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
view.getSidePanel().setHeapSize(roundState.getGameHeap().getSize());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +424,6 @@ public class RoundControl {
|
||||||
Hand.WIDTH - 1, rowCount - 1));
|
Hand.WIDTH - 1, rowCount - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
view.getSidePanel().setHeapSize(roundState.getGameHeap().getSize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealStone() {
|
private void dealStone() {
|
||||||
|
|
|
@ -247,4 +247,9 @@ public class GameSettings implements Serializable {
|
||||||
return (humans == 1);
|
return (humans == 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTotalStones() {
|
||||||
|
return getHighestValue() * getStoneSetNumber()
|
||||||
|
* getStoneColors().size() + getJokerNumber();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package jrummikub.view;
|
package jrummikub.view;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import jrummikub.model.GameSettings;
|
import jrummikub.model.GameSettings;
|
||||||
|
import jrummikub.model.IPlayer;
|
||||||
|
|
||||||
public interface ISidePanel {
|
public interface ISidePanel {
|
||||||
|
|
||||||
|
@ -10,4 +13,6 @@ public interface ISidePanel {
|
||||||
|
|
||||||
void setHeapSize(int size);
|
void setHeapSize(int size);
|
||||||
|
|
||||||
|
void setPlayers(List<IPlayer> players);
|
||||||
|
|
||||||
}
|
}
|
|
@ -16,6 +16,9 @@ import java.awt.event.AdjustmentListener;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
|
@ -26,16 +29,19 @@ import javax.swing.JProgressBar;
|
||||||
import javax.swing.JScrollBar;
|
import javax.swing.JScrollBar;
|
||||||
import javax.swing.JViewport;
|
import javax.swing.JViewport;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.CompoundBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import javax.swing.border.MatteBorder;
|
import javax.swing.border.MatteBorder;
|
||||||
|
|
||||||
import jrummikub.model.GameSettings;
|
import jrummikub.model.GameSettings;
|
||||||
|
import jrummikub.model.IPlayer;
|
||||||
|
import jrummikub.model.Player;
|
||||||
|
import jrummikub.model.PlayerSettings;
|
||||||
import jrummikub.view.ISidePanel;
|
import jrummikub.view.ISidePanel;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
class SidePanel extends JPanel implements ISidePanel {
|
class SidePanel extends JPanel implements ISidePanel {
|
||||||
//private InfoPanel infoPanel;
|
// private InfoPanel infoPanel;
|
||||||
private PlayerListPanel playerListPanel;
|
private PlayerListPanel playerListPanel;
|
||||||
private BottomScrollPane playerListScrollPane;
|
private BottomScrollPane playerListScrollPane;
|
||||||
private JLabel initialMeldLabel;
|
private JLabel initialMeldLabel;
|
||||||
|
@ -52,7 +58,8 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
|
||||||
InfoPanel infoPanel = new InfoPanel(createGameInfoPanel(), createRuleInfoPanel());
|
InfoPanel infoPanel = new InfoPanel(createGameInfoPanel(),
|
||||||
|
createRuleInfoPanel());
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy = 0;
|
c.gridy = 0;
|
||||||
c.weightx = 1;
|
c.weightx = 1;
|
||||||
|
@ -83,12 +90,12 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
colorLabel.setText("" + settings.getStoneColors().size());
|
colorLabel.setText("" + settings.getStoneColors().size());
|
||||||
noLimitsLabel.setVisible(settings.isNoLimits());
|
noLimitsLabel.setVisible(settings.isNoLimits());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHeapCapacity(int capacity) {
|
public void setHeapCapacity(int capacity) {
|
||||||
heapBar.setMaximum(capacity);
|
heapBar.setMaximum(capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHeapSize(int size) {
|
public void setHeapSize(int size) {
|
||||||
heapBar.setValue(size);
|
heapBar.setValue(size);
|
||||||
|
@ -99,11 +106,11 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
heapBar.setString("leer");
|
heapBar.setString("leer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createGameInfoPanel() {
|
private JPanel createGameInfoPanel() {
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new GridBagLayout());
|
panel.setLayout(new GridBagLayout());
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy = 0;
|
c.gridy = 0;
|
||||||
|
@ -113,24 +120,24 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
c.weightx = 1;
|
c.weightx = 1;
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
heapBar = new JProgressBar();
|
heapBar = new JProgressBar();
|
||||||
heapBar.setPreferredSize(new Dimension(16,16));
|
heapBar.setPreferredSize(new Dimension(16, 16));
|
||||||
panel.add(heapBar, c);
|
panel.add(heapBar, c);
|
||||||
|
|
||||||
heapBar.setStringPainted(true);
|
heapBar.setStringPainted(true);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createRuleInfoPanel() {
|
private JPanel createRuleInfoPanel() {
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new GridBagLayout());
|
panel.setLayout(new GridBagLayout());
|
||||||
initialMeldLabel = createRuleLine(panel, "Auslegeschranke", 0);
|
initialMeldLabel = createRuleLine(panel, "Auslegeschranke", 0);
|
||||||
setNumberLabel = createRuleLine(panel, "Steins\u00e4tze", 1);
|
setNumberLabel = createRuleLine(panel, "Steins\u00e4tze", 1);
|
||||||
highestValueLabel = createRuleLine(panel,"Steinwert", 2);
|
highestValueLabel = createRuleLine(panel, "Steinwert", 2);
|
||||||
handStonesLabel = createRuleLine(panel, "Startsteine", 3);
|
handStonesLabel = createRuleLine(panel, "Startsteine", 3);
|
||||||
jokerLabel = createRuleLine(panel, "Joker", 4);
|
jokerLabel = createRuleLine(panel, "Joker", 4);
|
||||||
colorLabel = createRuleLine(panel, "Farben", 5);
|
colorLabel = createRuleLine(panel, "Farben", 5);
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy = 6;
|
c.gridy = 6;
|
||||||
|
@ -144,7 +151,7 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JLabel createRuleLine(JPanel panel, String name, int line) {
|
private JLabel createRuleLine(JPanel panel, String name, int line) {
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
|
@ -247,7 +254,7 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
|
|
||||||
c.insets = new Insets(4, 8, 4, 8);
|
c.insets = new Insets(4, 8, 4, 8);
|
||||||
add(gameInfoPanel, c);
|
add(gameInfoPanel, c);
|
||||||
|
|
||||||
showRules = new JCheckBox("Regeln");
|
showRules = new JCheckBox("Regeln");
|
||||||
showRules.setSelected(true);
|
showRules.setSelected(true);
|
||||||
setupTriangleIcons(showRules);
|
setupTriangleIcons(showRules);
|
||||||
|
@ -312,25 +319,47 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
|
|
||||||
class PlayerListItem extends JPanel {
|
class PlayerListItem extends JPanel {
|
||||||
JLabel playerName;
|
JLabel playerName;
|
||||||
|
JLabel playerStatus;
|
||||||
|
JLabel playerColor;
|
||||||
|
|
||||||
|
|
||||||
public PlayerListItem() {
|
public PlayerListItem(IPlayer player) {
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
|
setBorder(new EmptyBorder(0, 4, 0, 4));
|
||||||
|
PlayerSettings settings = player.getPlayerSettings();
|
||||||
|
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy = 0;
|
c.gridy = 0;
|
||||||
|
c.gridheight = 2;
|
||||||
|
c.weighty = 1;
|
||||||
|
c.insets = new Insets(4, 4, 4, 4);
|
||||||
|
playerColor = new JLabel(ImageUtil.createColorIcon(
|
||||||
|
settings.getColor(), 12, 1));
|
||||||
|
add(playerColor, c);
|
||||||
|
|
||||||
|
c.gridx = 1;
|
||||||
|
c.gridy = 0;
|
||||||
|
c.gridheight = 1;
|
||||||
c.weightx = 1;
|
c.weightx = 1;
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
c.insets = new Insets(5, 5, 5, 5);
|
c.insets = new Insets(2,2,2,2);
|
||||||
|
|
||||||
playerName = new JLabel("<html>Horst<br>> 9000 Steine");
|
playerName = new JLabel(settings.getName());
|
||||||
|
playerName.putClientProperty("html.disable", Boolean.TRUE);
|
||||||
add(playerName, c);
|
add(playerName, c);
|
||||||
|
|
||||||
|
c.gridx = 1;
|
||||||
|
c.gridy = 1;
|
||||||
|
playerStatus = new JLabel(player.getLaidOut() ? "rausgekommen" : "nicht rausgekommen");
|
||||||
|
add(playerStatus, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PlayerListPanel extends JPanel {
|
class PlayerListPanel extends JPanel {
|
||||||
JPanel startSpacer;
|
JPanel startSpacer;
|
||||||
|
List<PlayerListItem> listItems = new ArrayList<PlayerListItem>();
|
||||||
|
|
||||||
public PlayerListPanel() {
|
public PlayerListPanel() {
|
||||||
setBackground(Color.GRAY);
|
setBackground(Color.GRAY);
|
||||||
|
@ -346,14 +375,25 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
c.weighty = 1;
|
c.weighty = 1;
|
||||||
c.fill = GridBagConstraints.BOTH;
|
c.fill = GridBagConstraints.BOTH;
|
||||||
add(startSpacer, c);
|
add(startSpacer, c);
|
||||||
c.weighty = 0;
|
|
||||||
c.fill = GridBagConstraints.HORIZONTAL;
|
|
||||||
|
|
||||||
for (int i = 1; i <= 4; i++) {
|
}
|
||||||
c.gridx = 0;
|
|
||||||
c.gridy = i;
|
public void setPlayers(List<IPlayer> players) {
|
||||||
c.insets = new Insets(i == 1 ? 0 : 1, 0, 0, 0);
|
for (PlayerListItem item : listItems) {
|
||||||
add(new PlayerListItem(), c);
|
remove(item);
|
||||||
|
}
|
||||||
|
listItems.clear();
|
||||||
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
|
c.gridx = 0;
|
||||||
|
c.gridy = 0;
|
||||||
|
c.weightx = 1;
|
||||||
|
c.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
for (IPlayer player : players) {
|
||||||
|
c.gridy++;
|
||||||
|
c.insets = new Insets(c.gridy == 1 ? 0 : 1, 0, 0, 0);
|
||||||
|
PlayerListItem item = new PlayerListItem(player);
|
||||||
|
listItems.add(item);
|
||||||
|
add(item, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,4 +404,10 @@ class SidePanel extends JPanel implements ISidePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayers(List<IPlayer> players) {
|
||||||
|
playerListPanel.setPlayers(players);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue