summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r--src/jrummikub/view/impl/SettingsPanel.java79
1 files changed, 33 insertions, 46 deletions
diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java
index 9262ee8..6f14d19 100644
--- a/src/jrummikub/view/impl/SettingsPanel.java
+++ b/src/jrummikub/view/impl/SettingsPanel.java
@@ -320,8 +320,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
@Override
public void setGameSettings(GameSettings gameSettings) {
- while (playerSettingsPanels.size() > gameSettings.getPlayerList()
- .size()) {
+ while (playerSettingsPanels.size() > gameSettings.getPlayerList().size()) {
removePlayerSettingsPanel();
}
@@ -330,22 +329,19 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
if (i < playerTypeChoices.size()) {
choices = playerTypeChoices.get(i);
}
- updatePlayerSettingsPanel(i, gameSettings.getPlayerList().get(i),
- choices);
+ updatePlayerSettingsPanel(i, gameSettings.getPlayerList().get(i), choices);
}
setInitialSettingsValue(gameSettings);
- initialMeldThresholdLabel.setText(gameSettings
- .getInitialMeldThreshold() + " Punkte");
+ initialMeldThresholdLabel.setText(gameSettings.getInitialMeldThreshold()
+ + " Punkte");
stoneSetNumberLabel.setText(Integer.toString(gameSettings
.getStoneSetNumber()));
- highestValueLabel.setText(Integer.toString(gameSettings
- .getHighestValue()));
+ highestValueLabel.setText(Integer.toString(gameSettings.getHighestValue()));
numberOfStonesDealtLabel.setText(Integer.toString(gameSettings
.getNumberOfStonesDealt()));
- jokerNumberLabel
- .setText(Integer.toString(gameSettings.getJokerNumber()));
+ jokerNumberLabel.setText(Integer.toString(gameSettings.getJokerNumber()));
timeLabel.setText(gameSettings.getTotalTime() + " Sekunden");
noLimitsLabel.setText(gameSettings.isNoLimits() ? "An" : "Aus");
@@ -366,12 +362,11 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
}
private void setInitialSettingsValue(GameSettings gameSettings) {
- initialMeldThresholdSpinner.setValue(gameSettings
- .getInitialMeldThreshold());
+ initialMeldThresholdSpinner
+ .setValue(gameSettings.getInitialMeldThreshold());
stoneSetNumberSpinner.setValue(gameSettings.getStoneSetNumber());
highestValueSpinner.setValue(gameSettings.getHighestValue());
- numberOfStonesDealtSpinner.setValue(gameSettings
- .getNumberOfStonesDealt());
+ numberOfStonesDealtSpinner.setValue(gameSettings.getNumberOfStonesDealt());
jokerNumberSpinner.setValue(gameSettings.getJokerNumber());
timeSpinner.setValue(gameSettings.getTotalTime());
noLimitsBox.setSelected(gameSettings.isNoLimits());
@@ -389,8 +384,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
private void addPlayerSettingsPanel(int i, PlayerSettings settings,
List<Type> choices) {
- PlayerSettingsPanel panel = new PlayerSettingsPanel(i, settings,
- choices, settingsMode != SettingsMode.NETWORK_OFFER
+ PlayerSettingsPanel panel = new PlayerSettingsPanel(i, settings, choices,
+ settingsMode != SettingsMode.NETWORK_OFFER
&& settingsMode != SettingsMode.NETWORK_JOIN);
playerSettingsPanels.add(panel);
playerSettingsViewport.add(panel,
@@ -400,8 +395,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
}
private void removePlayerSettingsPanel() {
- PlayerSettingsPanel p = playerSettingsPanels
- .remove(playerSettingsPanels.size() - 1);
+ PlayerSettingsPanel p = playerSettingsPanels.remove(playerSettingsPanels
+ .size() - 1);
playerSettingsViewport.remove(p);
}
@@ -423,8 +418,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
playerSettingsViewport.add(addPlayerPanel);
addPlayerButton = new JButton("+");
- addPlayerButton
- .setFont(addPlayerButton.getFont().deriveFont(Font.BOLD));
+ addPlayerButton.setFont(addPlayerButton.getFont().deriveFont(Font.BOLD));
addPlayerButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -473,8 +467,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
makeOptionLabel(row++, "H\u00f6chster Steinwert:");
highestValueLabel = new JLabel();
- highestValueSpinner = createOptionSpinner(3, 99, 1,
- changeHighestValueEvent);
+ highestValueSpinner = createOptionSpinner(3, 99, 1, changeHighestValueEvent);
makeOptionLabel(row++, "Anzahl Startsteine:");
numberOfStonesDealtLabel = new JLabel();
@@ -483,8 +476,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
makeOptionLabel(row++, "Jokeranzahl:");
jokerNumberLabel = new JLabel();
- jokerNumberSpinner = createOptionSpinner(1, 999, 1,
- changeJokerNumberEvent);
+ jokerNumberSpinner = createOptionSpinner(0, 999, 1, changeJokerNumberEvent);
makeOptionLabel(row++, "Zeit f\u00fcr Spielzug:");
timeLabel = new JLabel();
@@ -637,8 +629,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
final Event1<Integer> targetEvent) {
final JSpinner spinner = new JSpinner();
spinner.setModel(new SpinnerNumberModel(min, min, max, step));
- spinner.setPreferredSize(new Dimension(60,
- spinner.getMinimumSize().height));
+ spinner
+ .setPreferredSize(new Dimension(60, spinner.getMinimumSize().height));
spinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
@@ -699,8 +691,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
addDefaultButtons();
- setBorder(new CompoundBorder(new LineBorder(Color.BLACK),
- new EmptyBorder(10, 10, 10, 10)));
+ setBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder(
+ 10, 10, 10, 10)));
}
void resetTabbedPane() {
@@ -828,8 +820,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
private JLabel typeLabel;
public void setSettings(PlayerSettings settings) {
- if (nameField != null
- && !nameField.getText().equals(settings.getName())) {
+ if (nameField != null && !nameField.getText().equals(settings.getName())) {
nameField.setText(settings.getName());
}
if (nameLabel != null) {
@@ -846,8 +837,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
if (typeLabel != null) {
typeLabel.setText(getTypeLabel(settings.getType()));
}
- colorButton.setIcon(ImageUtil.createColorIcon(settings.getColor(),
- 16, 2));
+ colorButton
+ .setIcon(ImageUtil.createColorIcon(settings.getColor(), 16, 2));
colorChangable = !((settingsMode == SettingsMode.NETWORK_JOIN | settingsMode == SettingsMode.NETWORK_OFFER) & settings
.getType() != Type.HUMAN);
@@ -941,8 +932,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
c.gridy = 0;
add(colorButton, c);
- nameField.getDocument().addDocumentListener(
- new NameChangeListener());
+ nameField.getDocument().addDocumentListener(new NameChangeListener());
c2.gridy = 0;
c2.weightx = 1;
c2.fill = GridBagConstraints.HORIZONTAL;
@@ -957,8 +947,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
});
playerType.setPreferredSize(new Dimension(120, playerType
.getPreferredSize().height));
- playerType.setMinimumSize(new Dimension(120, playerType
- .getMinimumSize().height));
+ playerType.setMinimumSize(new Dimension(120,
+ playerType.getMinimumSize().height));
add(playerType, c);
removeButton = new JButton("\u00d7");
@@ -1001,8 +991,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
typeLabel.setBorder(new EmptyBorder(3, 7, 3, 7));
typeLabel.setPreferredSize(new Dimension(120, typeLabel
.getPreferredSize().height));
- typeLabel.setMinimumSize(new Dimension(120, typeLabel
- .getMinimumSize().height));
+ typeLabel.setMinimumSize(new Dimension(120,
+ typeLabel.getMinimumSize().height));
add(typeLabel, c);
}
@@ -1010,9 +1000,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
for (Component component : this.getComponents()) {
- preferredSize.setSize(
- preferredSize.width,
- Math.max(preferredSize.height,
+ preferredSize
+ .setSize(preferredSize.width, Math.max(preferredSize.height,
component.getPreferredSize().height));
}
return preferredSize;
@@ -1022,9 +1011,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
public Dimension getMaximumSize() {
Dimension preferredSize = super.getPreferredSize();
for (Component component : this.getComponents()) {
- preferredSize.setSize(
- Integer.MAX_VALUE,
- Math.max(preferredSize.height,
+ preferredSize
+ .setSize(Integer.MAX_VALUE, Math.max(preferredSize.height,
component.getPreferredSize().height));
}
return preferredSize;
@@ -1058,8 +1046,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
add(new ColorButton(c, menu));
} else {
add(new JLabel(ImageUtil.createColorIcon(
- UIManager.getColor("PopupMenu.background"), 16,
- 0)));
+ UIManager.getColor("PopupMenu.background"), 16, 0)));
}
}