diff options
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/ITablePanel.java | 24 | ||||
-rw-r--r-- | src/jrummikub/view/IView.java | 7 | ||||
-rw-r--r-- | src/jrummikub/view/impl/TablePanel.java | 46 | ||||
-rw-r--r-- | src/jrummikub/view/impl/View.java | 6 |
4 files changed, 12 insertions, 71 deletions
diff --git a/src/jrummikub/view/ITablePanel.java b/src/jrummikub/view/ITablePanel.java index d146ca3..5f07369 100644 --- a/src/jrummikub/view/ITablePanel.java +++ b/src/jrummikub/view/ITablePanel.java @@ -10,30 +10,6 @@ import jrummikub.util.Pair; */ public interface ITablePanel extends IStonePanel, IClickable { /** - * Sets the player name on the left label - * - * @param playerName - * the name to set - */ - public void setLeftPlayerName(String playerName); - - /** - * Sets the player name on the top label - * - * @param playerName - * the name to set - */ - public void setTopPlayerName(String playerName); - - /** - * Sets the player name on the right label - * - * @param playerName - * the name to set - */ - public void setRightPlayerName(String playerName); - - /** * Sets the stone sets lying on the table * * @param stoneSets diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java index ec154be..67e0885 100644 --- a/src/jrummikub/view/IView.java +++ b/src/jrummikub/view/IView.java @@ -87,4 +87,11 @@ public interface IView { * @return the event */ IEvent getNewRoundEvent(); + + /** + * Shows or hides the game settings panel + * + * @param show specifies if the panel shall be shown or hidden + */ + void showSettingsPanel(boolean show); } diff --git a/src/jrummikub/view/impl/TablePanel.java b/src/jrummikub/view/impl/TablePanel.java index 74a2b1f..31f6296 100644 --- a/src/jrummikub/view/impl/TablePanel.java +++ b/src/jrummikub/view/impl/TablePanel.java @@ -1,6 +1,5 @@ package jrummikub.view.impl; -import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; @@ -17,7 +16,6 @@ import java.util.Collections; import java.util.List; import javax.swing.ImageIcon; -import javax.swing.JLabel; import javax.swing.SwingUtilities; import jrummikub.model.Position; @@ -49,7 +47,6 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { private final float COLLECTION_RATIO = 0.12f; private final int COLLECTION_GAP = 5; - private JLabel leftPlayerLabel, topPlayerLabel, rightPlayerLabel; private StoneCollectionPanel stoneCollection; private Iterable<Pair<StoneSet, Position>> stoneSets = Collections.emptySet(); @@ -62,21 +59,6 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { private StoneSet rightHoveredConnector; @Override - public void setLeftPlayerName(String playerName) { - leftPlayerLabel.setText(playerName); - } - - @Override - public void setTopPlayerName(String playerName) { - topPlayerLabel.setText(playerName); - } - - @Override - public void setRightPlayerName(String playerName) { - rightPlayerLabel.setText(playerName); - } - - @Override public Event1<StoneSet> getLeftConnectorClickEvent() { return leftConnectorClickEvent; } @@ -124,36 +106,12 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { repaint(); } - private void createLabels() { - leftPlayerLabel = new JLabel(); - leftPlayerLabel.setForeground(Color.WHITE); - leftPlayerLabel.setHorizontalAlignment(JLabel.LEFT); - leftPlayerLabel.setHorizontalTextPosition(JLabel.LEFT); - add(leftPlayerLabel); - - topPlayerLabel = new JLabel(); - topPlayerLabel.setHorizontalAlignment(JLabel.CENTER); - topPlayerLabel.setHorizontalTextPosition(JLabel.CENTER); - topPlayerLabel.setVerticalAlignment(JLabel.TOP); - topPlayerLabel.setVerticalTextPosition(JLabel.TOP); - topPlayerLabel.setForeground(Color.WHITE); - add(topPlayerLabel); - - rightPlayerLabel = new JLabel(); - rightPlayerLabel.setForeground(Color.WHITE); - rightPlayerLabel.setHorizontalAlignment(JLabel.RIGHT); - rightPlayerLabel.setHorizontalTextPosition(JLabel.RIGHT); - add(rightPlayerLabel); - } - /** * Creates a new Table instance */ TablePanel() { setLayout(null); - createLabels(); - stoneCollection = new StoneCollectionPanel(); stoneCollection.getOtherClickEvent().add(new IListener1<Point>() { @@ -206,10 +164,6 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { int x = insets.left, y = insets.top, width = getWidth() - insets.left - insets.right, height = getHeight() - insets.top - insets.bottom; - leftPlayerLabel.setBounds(x, y, width, height); - topPlayerLabel.setBounds(x, y, width, height); - rightPlayerLabel.setBounds(x, y, width, height); - int collectionHeight = (int) (height * COLLECTION_RATIO); stoneCollection .setBounds(x, y + height - collectionHeight - COLLECTION_GAP, width, diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 3c9dbe9..0bc2e23 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -155,6 +155,11 @@ public class View extends JFrame implements IView { } @Override + public void showSettingsPanel(boolean show) { + settingsPanel.setVisible(show); + } + + @Override public void setCurrentPlayerName(String playerName) { playerPanel.setCurrentPlayerName(playerName); startTurnPanel.setCurrentPlayerName(playerName); @@ -175,5 +180,4 @@ public class View extends JFrame implements IView { public IEvent getFinalScoreEvent() { return winPanel.getFinalScoreEvent(); } - } |