use of org.pepsoft.worldpainter.Platform.Capability.BIOMES in project WorldPainter by Captain-Chaos.
the class App method createBiomesPanel.
private JPanel createBiomesPanel() {
final JPanel biomesPanel = new JPanel();
biomesPanel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(1, 1, 1, 1);
Configuration config = Configuration.getInstance();
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
constraints.weightx = 0.0;
biomesCheckBox = new JCheckBox("Show:");
biomesCheckBox.setHorizontalTextPosition(SwingConstants.LEADING);
biomesCheckBox.setToolTipText("Uncheck to hide biomes from view (it will still be exported)");
biomesCheckBox.addActionListener(e -> {
if (biomesCheckBox.isSelected()) {
hiddenLayers.remove(Biome.INSTANCE);
} else {
hiddenLayers.add(Biome.INSTANCE);
}
updateLayerVisibility();
});
if (!config.isEasyMode()) {
constraints.gridwidth = 1;
constraints.weightx = 0.0;
biomesPanel.add(biomesCheckBox, constraints);
}
biomesSoloCheckBox = new JCheckBox("Solo:");
biomesSoloCheckBox.setHorizontalTextPosition(SwingConstants.LEADING);
biomesSoloCheckBox.setToolTipText("<html>Check to show <em>only</em> the biomes (the other layers are still exported)</html>");
biomesSoloCheckBox.addActionListener(e -> {
if (biomesSoloCheckBox.isSelected()) {
layerSoloCheckBoxes.values().stream().filter(otherSoloCheckBox -> otherSoloCheckBox != biomesSoloCheckBox).forEach(otherSoloCheckBox -> otherSoloCheckBox.setSelected(false));
soloLayer = Biome.INSTANCE;
} else {
soloLayer = null;
}
updateLayerVisibility();
});
layerSoloCheckBoxes.put(Biome.INSTANCE, biomesSoloCheckBox);
if (!config.isEasyMode()) {
constraints.gridwidth = GridBagConstraints.REMAINDER;
biomesPanel.add(biomesSoloCheckBox, constraints);
}
biomesPanel.add(new BiomesPanel(defaultColourScheme, customBiomeManager, biomeId -> {
paintUpdater = () -> {
paint = PaintFactory.createDiscreteLayerPaint(Biome.INSTANCE, biomeId);
paintChanged();
};
paintUpdater.updatePaint();
}, paintButtonGroup), constraints);
return biomesPanel;
}
Aggregations