use of swinglib.JPanelBuilder in project triplea by triplea-game.
the class MapOptionsPanel method build.
static JPanel build(final GameData gameData, final StagingScreen screen) {
final GameProperties properties = gameData.getProperties();
final List<IEditableProperty> props = properties.getEditableProperties();
final JPanelBuilder panelBuilder = JPanelBuilder.builder().gridBagLayout(2).add(new JLabel("<html><h2>Map Options</h2></html>")).add(new JPanel());
props.stream().filter(prop -> !prop.getName().contains("bid")).forEach(prop -> {
panelBuilder.add(JLabelBuilder.builder().textWithMaxLength(prop.getName(), 25).tooltip(prop.getName()).build());
panelBuilder.add(screen != StagingScreen.NETWORK_CLIENT ? prop.getEditorComponent() : prop.getEditorComponentDisabled());
});
return panelBuilder.build();
}
use of swinglib.JPanelBuilder in project triplea by triplea-game.
the class HandicapPanel method build.
/**
* Builds a 'Handicap' panel, see class comment for more details.
*/
public static List<JComponent> build(final GameData gameData) {
final List<JComponent> selectionPanels = new ArrayList<>();
final Set<String> alliances = gameData.getAllianceTracker().getAlliances();
for (final String alliance : alliances) {
final JPanelBuilder allianceSelection = JPanelBuilder.builder().borderEtched().gridBagLayout(4).addLabel("<html><h2>" + alliance + "</h2></html").addLabel("<html><b>Bid</b></html").addLabel("<html><b>Income<br />Bonus</b></html").addLabel("<html><b>Income<br />Multiplier</b></html");
for (final PlayerID player : gameData.getAllianceTracker().getPlayersInAlliance(alliance)) {
allianceSelection.add(new JLabel(player.getName()));
final JTextField bid = new JTextField("0", 3);
allianceSelection.add(JPanelBuilder.builder().flowLayout().add(bid).add(Box.createVerticalGlue()).build());
final JTextField income = new JTextField("0", 3);
allianceSelection.add(JPanelBuilder.builder().flowLayout().add(income).add(Box.createVerticalGlue()).build());
final JTextField multiplier = new JTextField("100%", 5);
allianceSelection.add(JPanelBuilder.builder().flowLayout().add(multiplier).add(Box.createVerticalGlue()).build());
}
selectionPanels.add(allianceSelection.build());
}
return selectionPanels;
}
use of swinglib.JPanelBuilder in project triplea by triplea-game.
the class PlayerSelectionPanel method networkClientAlliancePanel.
/**
* <pre>
* .
* [Country Label] [Player Label | Play button] [stand button]
* </pre>
*/
private JPanel networkClientAlliancePanel(final String alliance) {
// TODO: make the alliance label a button to play the entire alliance
final JPanelBuilder panelBuilder = JPanelBuilder.builder().borderEtched().gridBagLayout(2).addHtmlLabel("<h2>" + alliance + "</h2>").addEmptyLabel();
for (final PlayerID country : playerSelectionModel.getPlayersInAlliance(alliance)) {
panelBuilder.addLabel(country.getName());
panelBuilder.add(swingComponents.buildPlayerIndicator(StagingScreen.NETWORK_CLIENT, country));
}
return panelBuilder.build();
}
use of swinglib.JPanelBuilder in project triplea by triplea-game.
the class PlayerSelectionPanel method singlePlayerAlliancePanel.
private JPanel singlePlayerAlliancePanel(final String alliance) {
// first row, just the alliance 'h2' label and then spacers to fill out the columns
final JPanelBuilder panelBuilder = JPanelBuilder.builder().borderEtched().gridBagLayout(2).addHtmlLabel("<h2>" + alliance + "</h2>").addEmptyLabel();
// next we build one row per country
for (final PlayerID country : playerSelectionModel.getPlayersInAlliance(alliance)) {
panelBuilder.addLabel(country.getName());
panelBuilder.add(swingComponents.buildAiSelectionCombo(country));
}
return panelBuilder.build();
}
use of swinglib.JPanelBuilder in project triplea by triplea-game.
the class PlayerSelectionPanel method networkHostAlliancePanel.
/**
* <pre>
* .
* [Country Label] [Player Label | Play Button] [Kick Button | Stand up button] [Ai/Human Combo]
* </pre>
*/
private JPanel networkHostAlliancePanel(final String alliance) {
final JPanelBuilder panelBuilder = JPanelBuilder.builder().borderEtched().gridBagLayout(3).addHtmlLabel("<h2>" + alliance + "</h2>").addEmptyLabel().addEmptyLabel();
for (final PlayerID country : playerSelectionModel.getPlayersInAlliance(alliance)) {
panelBuilder.addLabel(country.getName());
panelBuilder.add(swingComponents.buildPlayerIndicator(StagingScreen.NETWORK_HOST, country));
if (playerSelectionModel.isCountryTakenByCurrentPlayer(country)) {
panelBuilder.add(swingComponents.buildAiSelectionCombo(country));
} else {
panelBuilder.addEmptyLabel();
}
}
return panelBuilder.build();
}
Aggregations