Miscellaneous code cleanup

This commit is contained in:
FlavianIuga 2023-01-25 16:22:50 +02:00
parent 4db447e9e6
commit bbce187863
12 changed files with 17 additions and 21 deletions

View File

@ -154,9 +154,7 @@ public final class ConnectController extends FreeColClientHolder {
switch (reason) {
case DEFEATED: case QUIT:
fcc.logout(false);
SwingUtilities.invokeLater(() -> {
mainTitle();
});
SwingUtilities.invokeLater(this::mainTitle);
break;
case LOGIN: // Occurs when you Open a new game during a current one
fcc.logout(false);

View File

@ -42,7 +42,7 @@ public class Animations {
*/
public interface Procedure {
void execute();
};
}
/**
* Collect animations for a unit move.

View File

@ -123,7 +123,7 @@ public class Flag {
public Set<UnionPosition> getUnionPositions() {
return this.unionPositions;
}
};
}
/**
* The shape of the "union", which generally depends on the
@ -135,7 +135,7 @@ public class Flag {
CHEVRON,
BEND,
RHOMBUS
};
}
/**
* The position of the "union", which depends on the alignment of

View File

@ -72,7 +72,7 @@ public class FreeColDialog<T> extends JDialog implements PropertyChangeListener
public enum DialogType {
PLAIN,
QUESTION,
};
}
/** The enclosing client. */
protected final FreeColClient freeColClient;

View File

@ -365,7 +365,7 @@ public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
super(new MigLayout("wrap 1", "", ""));
this.source = source;
this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<Goods>());
this.goodsBox = new JComboBox<>(new DefaultComboBoxModel<>());
this.goodsBox.setRenderer(new GoodsBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
@ -494,7 +494,7 @@ public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
this.source = source;
this.other = other;
this.victimBox = new JComboBox<>(new DefaultComboBoxModel<Player>());
this.victimBox = new JComboBox<>(new DefaultComboBoxModel<>());
this.victimBox.setRenderer(new InciteBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
@ -615,7 +615,7 @@ public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
this.source = source;
this.target = target;
this.stanceBox = new JComboBox<>(new DefaultComboBoxModel<Stance>());
this.stanceBox = new JComboBox<>(new DefaultComboBoxModel<>());
this.stanceBox.setRenderer(new StanceBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);
@ -733,7 +733,7 @@ public final class NegotiationDialog extends FreeColDialog<DiplomaticTrade> {
super(new MigLayout("wrap 1", "", ""));
this.source = source;
this.unitBox = new JComboBox<>(new DefaultComboBoxModel<Unit>());
this.unitBox = new JComboBox<>(new DefaultComboBoxModel<>());
this.unitBox.setRenderer(new UnitBoxRenderer());
this.clearButton = Utility.localizedButton("negotiationDialog.clear");
this.clearButton.addActionListener(this);

View File

@ -253,7 +253,7 @@ public final class BaseTileTransitionImageCreator {
return null;
}
final ImageResource terrainImageResource;
final boolean notABeachTransition = borderingTile.isLand() || !borderingTile.isLand() && !tile.isLand();;
final boolean notABeachTransition = borderingTile.isLand() || !borderingTile.isLand() && !tile.isLand();
if (notABeachTransition) {
terrainImageResource = ImageCache.getImageResource(ImageLibrary.getTerrainImageKey(borderingTile.getType()));
} else {

View File

@ -334,7 +334,7 @@ public class InGameMenuBar extends FreeColMenuBar {
final FontMetrics fm = g2d.getFontMetrics();
final Rectangle2D d = fm.getStringBounds(text, g2d);
final int textWidth = (int) d.getWidth();
final int textHeight = (int) d.getHeight();;
final int textHeight = (int) d.getHeight();
final int rightSidePaddingInPx = 10;
final int centerHeight = getHeight() - getInsets().bottom;

View File

@ -84,7 +84,7 @@ public final class OptionGroupUI extends MigPanel
Option option = (Option)node.getUserObject();
return Messages.getName(option.getId());
}
};
}
private final List<OptionUpdater> optionUpdaters = new ArrayList<>();

View File

@ -1276,8 +1276,7 @@ public final class ColonyPanel extends PortPanel
*/
@Override
public JToolTip createToolTip() {
JToolTip toolTip = new RebelToolTip(getFreeColClient(), getColony());
return toolTip;
return new RebelToolTip(getFreeColClient(), getColony());
}

View File

@ -187,8 +187,8 @@ public class FreeColImageBorder extends AbstractBorder {
return image;
}
final Dimension scaledDimensions = new Dimension(
(int) Math.round(image.getWidth() * scaleFactor),
(int) Math.round(image.getHeight() * scaleFactor)
Math.round(image.getWidth() * scaleFactor),
Math.round(image.getHeight() * scaleFactor)
);
return ir.getImage(scaledDimensions, false);
}

View File

@ -101,8 +101,7 @@ public final class MainPanel extends FreeColPanel {
}
private JButton createImportantButton(Action action) {
final FreeColButton button = new FreeColButton(ButtonStyle.IMPORTANT, action);
return button;
return new FreeColButton(ButtonStyle.IMPORTANT, action);
}

View File

@ -73,7 +73,7 @@ public final class NewPanel extends FreeColPanel implements ItemListener {
START,
META_SERVER,
SHOW_DIFFICULTY
};
}
/**
* A particular specification to use for the new game. If not