summaryrefslogtreecommitdiffstats
path: root/src/jrummikub
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub')
-rw-r--r--src/jrummikub/control/network/ConnectionControl.java4
-rw-r--r--src/jrummikub/control/network/GameJoinControl.java74
-rw-r--r--src/jrummikub/control/network/GameOfferControl.java94
-rw-r--r--src/jrummikub/view/impl/SettingsPanel.java195
4 files changed, 135 insertions, 232 deletions
diff --git a/src/jrummikub/control/network/ConnectionControl.java b/src/jrummikub/control/network/ConnectionControl.java
index 21d2c8b..6dc1bb5 100644
--- a/src/jrummikub/control/network/ConnectionControl.java
+++ b/src/jrummikub/control/network/ConnectionControl.java
@@ -9,12 +9,10 @@ import jrummikub.model.GameSettings;
import jrummikub.util.Event;
import jrummikub.util.Event1;
import jrummikub.util.Event2;
-import jrummikub.util.Event3;
import jrummikub.util.GameData;
import jrummikub.util.IEvent;
import jrummikub.util.IEvent1;
import jrummikub.util.IEvent2;
-import jrummikub.util.IEvent3;
import jrummikub.util.LoginData;
import org.jivesoftware.smack.Connection;
@@ -307,7 +305,7 @@ class ConnectionControl {
} else if (messageType.equals("game_join_ack")) {
gameJoinAckEvent
.emit(Boolean.valueOf(extension.getValue("ack")));
- } else if (messageType.equals("changeColor")) {
+ } else if (messageType.equals("change_color")) {
changeColorEvent.emit(sender, (Color) Base64
.decodeToObject(extension.getValue("color")));
} else {
diff --git a/src/jrummikub/control/network/GameJoinControl.java b/src/jrummikub/control/network/GameJoinControl.java
index afb78d4..1d29df4 100644
--- a/src/jrummikub/control/network/GameJoinControl.java
+++ b/src/jrummikub/control/network/GameJoinControl.java
@@ -1,43 +1,20 @@
package jrummikub.control.network;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
import jrummikub.model.GameSettings;
import jrummikub.model.PlayerSettings;
import jrummikub.model.PlayerSettings.Type;
-import jrummikub.util.Connection;
import jrummikub.util.Event;
import jrummikub.util.GameData;
-import jrummikub.util.IListener;
import jrummikub.util.IListener1;
-import jrummikub.util.IListener2;
-import jrummikub.util.IListener3;
-import jrummikub.view.ISettingsPanel;
-import jrummikub.view.IView;
import jrummikub.view.ISettingsPanel.SettingsMode;
+import jrummikub.view.IView;
-public class GameJoinControl {
- private List<Connection> connections = new ArrayList<Connection>();
- private GameData gameData;
- private ConnectionControl connectionControl;
- private IView view;
+public class GameJoinControl extends AbstractGameBeginControl {
private Event backEvent = new Event();
public GameJoinControl(final ConnectionControl connectionControl,
final GameData gameData, final IView view) {
- this.connectionControl = connectionControl;
- this.gameData = gameData;
- this.view = view;
-
- view.getSettingsPanel().setSettingsMode(SettingsMode.NETWORK_JOIN);
- view.getSettingsPanel().enableAddPlayerButton(false);
- view.getSettingsPanel().setGameSettings(gameData.getGameSettings());
+ super(connectionControl, view, gameData, SettingsMode.NETWORK_JOIN);
connections.add(connectionControl.getGameOfferEvent().add(
new IListener1<GameData>() {
@@ -50,38 +27,10 @@ public class GameJoinControl {
gameData.setGameSettings(settings);
- updateSettingsPanel(settings);
+ updateSettingsPanel();
}
}
}));
- connections.add(view.getSettingsPanel().getBackEvent().add(
- new IListener() {
- @Override
- public void handle() {
- goBack();
- }
- }));
- connections.add(view.getSettingsPanel().getChangePlayerColorEvent()
- .add(new IListener2<Integer, Color>() {
- @Override
- public void handle(Integer playerNumber, Color color) {
- // TODO Auto-generated method stub
-
- }
- }));
- }
-
- private void updateSettingsPanel(GameSettings settings) {
- view.getSettingsPanel().setGameSettings(settings);
-
- Set<Color> colors = new HashSet<Color>(Arrays
- .asList(ISettingsPanel.PLAYER_COLORS));
-
- for (PlayerSettings player : settings.getPlayerList()) {
- colors.remove(player.getColor());
- }
-
- view.getSettingsPanel().setPlayerColors(colors);
}
private void fixGameSettings(GameSettings settings) {
@@ -94,8 +43,8 @@ public class GameJoinControl {
}
}
}
-
- public Event getBackEvent(){
+
+ public Event getBackEvent() {
return backEvent;
}
@@ -106,20 +55,11 @@ public class GameJoinControl {
/**
* Aborts joining and goes back to game list
*/
- private void goBack() {
+ protected void goBack() {
abort();
connectionControl.leaveGame();
view.showSettingsPanel(false);
backEvent.emit();
}
- /**
- * Aborts joining
- */
- public void abort() {
- for (Connection c : connections) {
- c.remove();
- }
-
- }
}
diff --git a/src/jrummikub/control/network/GameOfferControl.java b/src/jrummikub/control/network/GameOfferControl.java
index f0dc526..f09eb6e 100644
--- a/src/jrummikub/control/network/GameOfferControl.java
+++ b/src/jrummikub/control/network/GameOfferControl.java
@@ -1,41 +1,23 @@
package jrummikub.control.network;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import java.util.UUID;
import jrummikub.model.GameSettings;
import jrummikub.model.PlayerSettings;
import jrummikub.model.PlayerSettings.Type;
-import jrummikub.util.Connection;
import jrummikub.util.GameData;
-import jrummikub.util.IListener;
import jrummikub.util.IListener1;
-import jrummikub.util.IListener2;
-import jrummikub.view.ISettingsPanel;
import jrummikub.view.ISettingsPanel.SettingsMode;
import jrummikub.view.IView;
-public class GameOfferControl {
- private List<Connection> connections = new ArrayList<Connection>();
- private GameData gameData;
- private ConnectionControl connectionControl;
- private IView view;
+public class GameOfferControl extends AbstractGameBeginControl {
public GameOfferControl(final ConnectionControl connectionControl,
final GameSettings settings, final IView view) {
- this.connectionControl = connectionControl;
- this.view = view;
-
- gameData = new GameData(UUID.randomUUID(), settings);
-
- view.getSettingsPanel().setSettingsMode(SettingsMode.NETWORK_OFFER);
- view.getSettingsPanel().enableAddPlayerButton(false);
- updateSettingsPanel(settings);
+ super(connectionControl, view,
+ new GameData(UUID.randomUUID(), settings),
+ SettingsMode.NETWORK_OFFER);
connections.add(connectionControl.getGameJoinEvent().add(
new IListener1<String>() {
@@ -45,7 +27,7 @@ public class GameOfferControl {
if (player.getType() == Type.VACANT) {
player.setName(sender);
player.setType(Type.NETWORK);
- updateSettingsPanel(settings);
+ updateSettingsPanel();
connectionControl.ackJoinGame(sender, true);
connectionControl.offerGame(gameData);
return;
@@ -55,60 +37,24 @@ public class GameOfferControl {
connectionControl.ackJoinGame(sender, false);
}
}));
- connections.add(view.getSettingsPanel().getChangePlayerColorEvent()
- .add(new IListener2<Integer, Color>() {
+ connections.add(connectionControl.getGameLeaveEvent().add(
+ new IListener1<String>() {
@Override
- public void handle(Integer i, Color color) {
- for (PlayerSettings player : settings.getPlayerList()) {
- if (player.getColor() == color) {
- return;
+ public void handle(String sender) {
+ List<PlayerSettings> players = gameData
+ .getGameSettings().getPlayerList();
+ for (PlayerSettings s : players) {
+ if (s.getName().equals(sender)
+ && s.getType() == Type.NETWORK) {
+ s.setType(Type.VACANT);
+ s.setName("Offen");
+ break;
}
}
- settings.getPlayerList().get(i).setColor(color);
- updateSettingsPanel(settings);
+ updateSettingsPanel();
+ connectionControl.offerGame(gameData);
}
}));
- connections.add(connectionControl.getGameLeaveEvent().add(new IListener1<String>() {
- @Override
- public void handle(String sender) {
- List<PlayerSettings> players = gameData.getGameSettings().getPlayerList();
- int index=0;
- for(PlayerSettings s:players){
- if (s.getName().equals(sender)){
- break;
- }
- index++;
- }
- //Only remove network players
- if(gameData.getGameSettings().getPlayerList().get(index).getType() == Type.NETWORK){
- gameData.getGameSettings().getPlayerList().get(index).setType(Type.VACANT);
- gameData.getGameSettings().getPlayerList().get(index).setName("Offen");
- }
- updateSettingsPanel(gameData.getGameSettings());
- connectionControl.offerGame(gameData);
-
- }
- }));
- connections.add(view.getSettingsPanel().getBackEvent().add(new IListener() {
- @Override
- public void handle() {
- // TODO Auto-generated method stub
-
- }
- }));
- }
-
- private void updateSettingsPanel(GameSettings settings) {
- view.getSettingsPanel().setGameSettings(settings);
-
- Set<Color> colors = new HashSet<Color>(
- Arrays.asList(ISettingsPanel.PLAYER_COLORS));
-
- for (PlayerSettings player : settings.getPlayerList()) {
- colors.remove(player.getColor());
- }
-
- view.getSettingsPanel().setPlayerColors(colors);
}
public void startGameOffer() {
@@ -118,7 +64,7 @@ public class GameOfferControl {
}
- public void abort() {
- connectionControl.withdrawGame();
+ protected void goBack() {
+ // TODO
}
}
diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java
index b5a69c5..b3e1604 100644
--- a/src/jrummikub/view/impl/SettingsPanel.java
+++ b/src/jrummikub/view/impl/SettingsPanel.java
@@ -245,37 +245,37 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
@Override
public void setError(SettingsError error) {
switch (error) {
- case NO_ERROR:
- errorMessageLabel.setText(" ");
- break;
- case DUPLICATE_PLAYER_NAME_ERROR:
- errorMessageLabel
- .setText("Jeder Spielername darf nur einmal verwendet werden.");
- errorMessageLabel.setForeground(Color.RED);
- break;
- case NO_PLAYER_NAME_ERROR:
- errorMessageLabel.setText("Jeder Spieler muss einen Namen haben.");
- errorMessageLabel.setForeground(Color.RED);
- break;
- case NOT_ENOUGH_STONES_ERROR:
- errorMessageLabel
- .setText("Es gibt nicht genug Steine f\u00fcr die gew\u00e4hlte Spieleranzahl.");
- errorMessageLabel.setForeground(Color.RED);
- break;
- case NOT_ENOUGH_COLORS_ERROR:
- errorMessageLabel
- .setText("Es m\u00fcssen mindestens drei Farben ausgew\u00e4hlt werden.");
- errorMessageLabel.setForeground(Color.RED);
- break;
- case COMPUTER_PLAYERS_ONLY_WARNING:
- errorMessageLabel.setText("Es gibt keinen menschlichen Spieler.");
- errorMessageLabel.setForeground(Color.ORANGE.darker());
- break;
- case TOO_HIGH_THRESHOLD_WARNING:
- errorMessageLabel
- .setText("Die gew\u00e4hlte Schranke ist m\u00f6glicherweise zu hoch");
- errorMessageLabel.setForeground(Color.ORANGE.darker());
- break;
+ case NO_ERROR:
+ errorMessageLabel.setText(" ");
+ break;
+ case DUPLICATE_PLAYER_NAME_ERROR:
+ errorMessageLabel
+ .setText("Jeder Spielername darf nur einmal verwendet werden.");
+ errorMessageLabel.setForeground(Color.RED);
+ break;
+ case NO_PLAYER_NAME_ERROR:
+ errorMessageLabel.setText("Jeder Spieler muss einen Namen haben.");
+ errorMessageLabel.setForeground(Color.RED);
+ break;
+ case NOT_ENOUGH_STONES_ERROR:
+ errorMessageLabel
+ .setText("Es gibt nicht genug Steine f\u00fcr die gew\u00e4hlte Spieleranzahl.");
+ errorMessageLabel.setForeground(Color.RED);
+ break;
+ case NOT_ENOUGH_COLORS_ERROR:
+ errorMessageLabel
+ .setText("Es m\u00fcssen mindestens drei Farben ausgew\u00e4hlt werden.");
+ errorMessageLabel.setForeground(Color.RED);
+ break;
+ case COMPUTER_PLAYERS_ONLY_WARNING:
+ errorMessageLabel.setText("Es gibt keinen menschlichen Spieler.");
+ errorMessageLabel.setForeground(Color.ORANGE.darker());
+ break;
+ case TOO_HIGH_THRESHOLD_WARNING:
+ errorMessageLabel
+ .setText("Die gew\u00e4hlte Schranke ist m\u00f6glicherweise zu hoch");
+ errorMessageLabel.setForeground(Color.ORANGE.darker());
+ break;
}
}
@@ -320,7 +320,8 @@ 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();
}
@@ -329,26 +330,30 @@ 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);
}
- 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());
- 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");
@@ -380,8 +385,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,
@@ -391,8 +396,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);
}
@@ -414,7 +419,8 @@ 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) {
@@ -451,7 +457,8 @@ 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();
@@ -460,7 +467,8 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
makeOptionLabel(row++, "Jokeranzahl:");
jokerNumberLabel = new JLabel();
- jokerNumberSpinner = createOptionSpinner(1, 999, 1, changeJokerNumberEvent);
+ jokerNumberSpinner = createOptionSpinner(1, 999, 1,
+ changeJokerNumberEvent);
makeOptionLabel(row++, "Zeit f\u00fcr Spielzug:");
timeLabel = new JLabel();
@@ -620,8 +628,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) {
@@ -682,8 +690,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() {
@@ -771,22 +779,22 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
buttonPanel.removeAll();
switch (mode) {
- case DEFAULT:
- addDefaultButtons();
- enableOptions(true);
- break;
- case NETWORK_SETUP:
- addNetworkSetupButtons();
- enableOptions(true);
- break;
- case NETWORK_OFFER:
- addNetworkOfferButtons();
- enableOptions(false);
- break;
- case NETWORK_JOIN:
- addNetworkJoinButtons();
- enableOptions(false);
- break;
+ case DEFAULT:
+ addDefaultButtons();
+ enableOptions(true);
+ break;
+ case NETWORK_SETUP:
+ addNetworkSetupButtons();
+ enableOptions(true);
+ break;
+ case NETWORK_OFFER:
+ addNetworkOfferButtons();
+ enableOptions(false);
+ break;
+ case NETWORK_JOIN:
+ addNetworkJoinButtons();
+ enableOptions(false);
+ break;
}
}
@@ -805,12 +813,14 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
private JButton removeButton;
private JComboBox playerType;
private List<Type> playerTypeChoices;
+ private boolean colorChangable = true;
private JLabel nameLabel;
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) {
@@ -827,8 +837,11 @@ 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);
}
public void setPlayerNameEditable(boolean editable) {
@@ -879,13 +892,13 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
private String getTypeLabel(Type type) {
switch (type) {
- case COMPUTER:
- return "Computer";
- case HUMAN:
- return "Mensch";
- case NETWORK:
- case VACANT:
- return "Netzwerk";
+ case COMPUTER:
+ return "Computer";
+ case HUMAN:
+ return "Mensch";
+ case NETWORK:
+ case VACANT:
+ return "Netzwerk";
}
return null;
@@ -919,7 +932,8 @@ 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;
@@ -934,8 +948,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");
@@ -961,7 +975,9 @@ class SettingsPanel extends JPanel implements ISettingsPanel {
colorButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- new ColorMenu();
+ if (colorChangable) {
+ new ColorMenu();
+ }
}
});
c.gridy = 0;
@@ -976,8 +992,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);
}
@@ -985,8 +1001,9 @@ 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;
@@ -996,8 +1013,9 @@ 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;
@@ -1031,7 +1049,8 @@ 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)));
}
}