Search in sources :

Example 1 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class FillDialog method initComponents.

/**
 * This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jLabel1 = new javax.swing.JLabel();
    buttonCancel = new javax.swing.JButton();
    buttonFill = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JSeparator();
    brushOptions1 = new org.pepsoft.worldpainter.panels.BrushOptions();
    jPanel1 = new javax.swing.JPanel();
    sliderLayerValue = new javax.swing.JSlider();
    comboBoxBiome = new javax.swing.JComboBox();
    radioButtonSetLayer = new javax.swing.JRadioButton();
    radioButtonResetBiomes = new javax.swing.JRadioButton();
    radioButtonClearLayer = new javax.swing.JRadioButton();
    radioButtonResetTerrain = new javax.swing.JRadioButton();
    radioButtonTerrain = new javax.swing.JRadioButton();
    comboBoxClearLayer = new javax.swing.JComboBox();
    radioButtonResetWater = new javax.swing.JRadioButton();
    comboBoxSetLayer = new javax.swing.JComboBox();
    comboBoxInvertLayer = new javax.swing.JComboBox();
    comboBoxTerrain = new javax.swing.JComboBox();
    radioButtonInvertLayer = new javax.swing.JRadioButton();
    radioButtonBiome = new javax.swing.JRadioButton();
    radioButtonMakeBiomesPermanent = new javax.swing.JRadioButton();
    radioButtonAddToSelection = new javax.swing.JRadioButton();
    radioButtonRemoveFromSelection = new javax.swing.JRadioButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Global Operations");
    jLabel1.setText("Perform a global operation:");
    buttonCancel.setText("Cancel");
    buttonCancel.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCancelActionPerformed(evt);
        }
    });
    buttonFill.setText("Go");
    buttonFill.setEnabled(false);
    buttonFill.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonFillActionPerformed(evt);
        }
    });
    jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
    sliderLayerValue.setMajorTickSpacing(7);
    sliderLayerValue.setMinimum(2);
    sliderLayerValue.setPaintTicks(true);
    sliderLayerValue.setSnapToTicks(true);
    sliderLayerValue.setEnabled(false);
    comboBoxBiome.setEnabled(false);
    buttonGroup1.add(radioButtonSetLayer);
    radioButtonSetLayer.setText("fill with layer:");
    radioButtonSetLayer.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonSetLayerActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonResetBiomes);
    radioButtonResetBiomes.setText("reset biomes to automatic");
    radioButtonResetBiomes.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonResetBiomesActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonClearLayer);
    radioButtonClearLayer.setText("remove a layer:");
    radioButtonClearLayer.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonClearLayerActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonResetTerrain);
    radioButtonResetTerrain.setText("reset terrain and layers to theme");
    radioButtonResetTerrain.setToolTipText("Reset the terrain type of the entire map to the altitude-dependent default");
    radioButtonResetTerrain.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonResetTerrainActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonTerrain);
    radioButtonTerrain.setText("fill with terrain type:");
    radioButtonTerrain.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonTerrainActionPerformed(evt);
        }
    });
    comboBoxClearLayer.setEnabled(false);
    buttonGroup1.add(radioButtonResetWater);
    radioButtonResetWater.setText("reset all water or lava");
    radioButtonResetWater.setToolTipText("This resets the fluid level and type (water or lava) to the default everywhere");
    radioButtonResetWater.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonResetWaterActionPerformed(evt);
        }
    });
    comboBoxSetLayer.setEnabled(false);
    comboBoxSetLayer.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            comboBoxSetLayerActionPerformed(evt);
        }
    });
    comboBoxInvertLayer.setEnabled(false);
    comboBoxTerrain.setModel(new DefaultComboBoxModel(Terrain.getConfiguredValues()));
    comboBoxTerrain.setEnabled(false);
    comboBoxTerrain.setRenderer(new TerrainListCellRenderer(colourScheme));
    buttonGroup1.add(radioButtonInvertLayer);
    radioButtonInvertLayer.setText("invert a layer:");
    radioButtonInvertLayer.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonInvertLayerActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonBiome);
    radioButtonBiome.setText("fill with biome:");
    radioButtonBiome.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonBiomeActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonMakeBiomesPermanent);
    radioButtonMakeBiomesPermanent.setText("make automatic biomes permanent");
    radioButtonMakeBiomesPermanent.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonMakeBiomesPermanentActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonAddToSelection);
    radioButtonAddToSelection.setText("add to selection");
    radioButtonAddToSelection.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonAddToSelectionActionPerformed(evt);
        }
    });
    buttonGroup1.add(radioButtonRemoveFromSelection);
    radioButtonRemoveFromSelection.setText("remove from selection");
    radioButtonRemoveFromSelection.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            radioButtonRemoveFromSelectionActionPerformed(evt);
        }
    });
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(radioButtonSetLayer).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxSetLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel1Layout.createSequentialGroup().addGap(12, 12, 12).addComponent(sliderLayerValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel1Layout.createSequentialGroup().addComponent(radioButtonClearLayer).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxClearLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel1Layout.createSequentialGroup().addComponent(radioButtonBiome).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxBiome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel1Layout.createSequentialGroup().addComponent(radioButtonInvertLayer).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxInvertLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(jPanel1Layout.createSequentialGroup().addComponent(radioButtonTerrain).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxTerrain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(radioButtonResetTerrain).addComponent(radioButtonResetBiomes).addComponent(radioButtonMakeBiomesPermanent).addComponent(radioButtonAddToSelection).addComponent(radioButtonRemoveFromSelection).addComponent(radioButtonResetWater)).addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonTerrain).addComponent(comboBoxTerrain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonResetTerrain).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonResetWater).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonSetLayer).addComponent(comboBoxSetLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(sliderLayerValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonClearLayer).addComponent(comboBoxClearLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonInvertLayer).addComponent(comboBoxInvertLayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonBiome).addComponent(comboBoxBiome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonMakeBiomesPermanent).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonResetBiomes).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonAddToSelection).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(radioButtonRemoveFromSelection)));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1).addGroup(layout.createSequentialGroup().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, 0).addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(brushOptions1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonFill).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(buttonCancel).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(0, 0, 0).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(jSeparator1).addComponent(brushOptions1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(buttonCancel).addComponent(buttonFill)).addContainerGap()));
    pack();
}
Also used : TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer) javax.swing(javax.swing)

Example 2 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class DimensionPropertiesEditor method setColourScheme.

public void setColourScheme(ColourScheme colourScheme) {
    comboBoxSubsurfaceMaterial.setRenderer(new TerrainListCellRenderer(colourScheme));
    themeEditor.setColourScheme(colourScheme);
}
Also used : TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer)

Example 3 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class SimpleThemeEditor method setTheme.

public void setTheme(SimpleTheme theme) {
    this.theme = theme;
    if (theme != null) {
        terrainTableModel = new TerrainRangesTableModel(theme.getTerrainRanges());
        terrainTableModel.setChangeListener(this);
        tableTerrain.setModel(terrainTableModel);
        tableTerrain.setDefaultRenderer(Integer.class, new DefaultTableCellRenderer());
        tableTerrain.setDefaultRenderer(Terrain.class, new TerrainTableCellRenderer(colourScheme));
        tableTerrain.setDefaultRenderer(JButton.class, new JButtonTableCellRenderer());
        tableTerrain.setDefaultEditor(Integer.class, new JSpinnerTableCellEditor(new SpinnerNumberModel(1, 1, theme.getMaxHeight() - 1, 1)));
        JComboBox terrainEditor = new JComboBox(Terrain.getConfiguredValues());
        terrainEditor.setRenderer(new TerrainListCellRenderer(colourScheme));
        tableTerrain.setDefaultEditor(Terrain.class, new DefaultCellEditor(terrainEditor));
        tableTerrain.setDefaultEditor(JButton.class, new JButtonTableCellEditor(this));
        checkBoxBeaches.setSelected(theme.isBeaches());
        spinnerWaterLevel.setModel(new SpinnerNumberModel(theme.getWaterHeight(), 0, theme.getMaxHeight() - 1, 1));
        spinnerWaterLevel.setEnabled(checkBoxBeaches.isSelected());
        checkBoxRandomise.setSelected(theme.isRandomise());
        layerTableModel = new LayerRangesTableModel(theme.getMaxHeight(), theme.getLayerMap());
        tableLayers.setModel(layerTableModel);
        tableLayers.setDefaultRenderer(Layer.class, new LayerTableCellRenderer());
        tableLayers.setDefaultRenderer(JButton.class, new JButtonTableCellRenderer());
        tableLayers.setDefaultEditor(Integer.class, new JSpinnerTableCellEditor(new SpinnerNumberModel(1, 1, theme.getMaxHeight() - 1, 1)));
        tableLayers.setDefaultEditor(JButton.class, new JButtonTableCellEditor(this));
    }
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JComboBox(javax.swing.JComboBox) JButtonTableCellRenderer(org.pepsoft.worldpainter.themes.JButtonTableCellRenderer) JButtonTableCellEditor(org.pepsoft.worldpainter.themes.JButtonTableCellEditor) TerrainTableCellRenderer(org.pepsoft.worldpainter.themes.TerrainTableCellRenderer) LayerTableCellRenderer(org.pepsoft.worldpainter.layers.LayerTableCellRenderer) JSpinnerTableCellEditor(org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor) TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) DefaultCellEditor(javax.swing.DefaultCellEditor)

Example 4 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class UndergroundPocketsDialog method initComponents.

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jLabel1 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    buttonCancel = new javax.swing.JButton();
    buttonOK = new javax.swing.JButton();
    jLabel6 = new javax.swing.JLabel();
    fieldName = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    buttonPickColour = new javax.swing.JButton();
    jLabel7 = new javax.swing.JLabel();
    spinnerOccurrence = new javax.swing.JSpinner();
    jLabel8 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jLabel10 = new javax.swing.JLabel();
    spinnerScale = new javax.swing.JSpinner();
    spinnerMaxLevel = new javax.swing.JSpinner();
    jLabel11 = new javax.swing.JLabel();
    spinnerMinLevel = new javax.swing.JSpinner();
    jLabel12 = new javax.swing.JLabel();
    radioButtonCustomMaterial = new javax.swing.JRadioButton();
    radioButtonTerrain = new javax.swing.JRadioButton();
    comboBoxTerrain = new javax.swing.JComboBox();
    jPanel1 = new javax.swing.JPanel();
    labelPreview = new javax.swing.JLabel();
    mixedMaterialChooser = new org.pepsoft.worldpainter.MixedMaterialChooser();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Configure Underground Pockets Layer");
    addComponentListener(new java.awt.event.ComponentAdapter() {

        public void componentResized(java.awt.event.ComponentEvent evt) {
            formComponentResized(evt);
        }
    });
    jLabel1.setText("Select your custom material or terrain type:");
    jLabel4.setText("Colour:");
    buttonCancel.setText("Cancel");
    buttonCancel.addActionListener(this::buttonCancelActionPerformed);
    buttonOK.setText("OK");
    buttonOK.addActionListener(this::buttonOKActionPerformed);
    jLabel6.setText("Name:");
    fieldName.setColumns(10);
    jLabel5.setBackground(java.awt.Color.orange);
    jLabel5.setText("                 ");
    jLabel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    jLabel5.setOpaque(true);
    buttonPickColour.setText("...");
    buttonPickColour.addActionListener(this::buttonPickColourActionPerformed);
    jLabel7.setText("Occurrence:");
    spinnerOccurrence.setModel(new javax.swing.SpinnerNumberModel(10, 1, 1000, 1));
    spinnerOccurrence.addChangeListener(this::spinnerOccurrenceStateChanged);
    jLabel8.setText("Scale:");
    jLabel9.setText("Levels:");
    jLabel10.setText("‰");
    spinnerScale.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(100), Integer.valueOf(1), null, Integer.valueOf(1)));
    spinnerScale.addChangeListener(this::spinnerScaleStateChanged);
    spinnerMaxLevel.setModel(new javax.swing.SpinnerNumberModel(255, 0, 255, 1));
    spinnerMaxLevel.addChangeListener(this::spinnerMaxLevelStateChanged);
    jLabel11.setText("%");
    spinnerMinLevel.setModel(new javax.swing.SpinnerNumberModel(0, 0, 255, 1));
    spinnerMinLevel.addChangeListener(this::spinnerMinLevelStateChanged);
    jLabel12.setText("-");
    buttonGroup1.add(radioButtonCustomMaterial);
    radioButtonCustomMaterial.setSelected(true);
    radioButtonCustomMaterial.setText("custom material:");
    radioButtonCustomMaterial.addActionListener(this::radioButtonCustomMaterialActionPerformed);
    buttonGroup1.add(radioButtonTerrain);
    radioButtonTerrain.setText("terrain:");
    radioButtonTerrain.addActionListener(this::radioButtonTerrainActionPerformed);
    comboBoxTerrain.setModel(new DefaultComboBoxModel(Terrain.VALUES));
    comboBoxTerrain.setEnabled(false);
    comboBoxTerrain.setRenderer(new TerrainListCellRenderer(colourScheme));
    comboBoxTerrain.addActionListener(this::comboBoxTerrainActionPerformed);
    jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
    labelPreview.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(labelPreview, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(labelPreview, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(buttonOK).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(buttonCancel).addGap(11, 11, 11)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel4).addComponent(jLabel7).addComponent(jLabel6).addComponent(jLabel8).addComponent(jLabel9)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(spinnerMinLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, 0).addComponent(jLabel12).addGap(0, 0, 0).addComponent(spinnerMaxLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(spinnerScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, 0).addComponent(jLabel11)).addComponent(fieldName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGroup(layout.createSequentialGroup().addComponent(spinnerOccurrence, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, 0).addComponent(jLabel10)).addGroup(layout.createSequentialGroup().addComponent(jLabel5).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(buttonPickColour)))).addGroup(layout.createSequentialGroup().addComponent(radioButtonTerrain).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxTerrain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(radioButtonCustomMaterial).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(mixedMaterialChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()))));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonCustomMaterial).addComponent(mixedMaterialChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(radioButtonTerrain).addComponent(comboBoxTerrain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel6).addComponent(fieldName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(19, 19, 19).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4).addComponent(jLabel5).addComponent(buttonPickColour)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel7).addComponent(spinnerOccurrence, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel10)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel8).addComponent(spinnerScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel11)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel9).addComponent(spinnerMaxLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(spinnerMinLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel12))).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(buttonCancel).addComponent(buttonOK)).addContainerGap()));
    pack();
}
Also used : TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer) javax.swing(javax.swing)

Example 5 with TerrainListCellRenderer

use of org.pepsoft.worldpainter.themes.TerrainListCellRenderer in project WorldPainter by Captain-Chaos.

the class AddTerrainRangeDialog method initComponents.

/**
 * This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    spinnerLevel = new javax.swing.JSpinner();
    jLabel3 = new javax.swing.JLabel();
    comboBoxTerrainType = new javax.swing.JComboBox();
    buttonCancel = new javax.swing.JButton();
    buttonOK = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Add Terrain Mapping");
    jLabel1.setText("Select a level and a terrain type to add to the mapping:");
    jLabel2.setLabelFor(spinnerLevel);
    jLabel2.setText("Level:");
    jLabel3.setLabelFor(comboBoxTerrainType);
    jLabel3.setText("Terrain type:");
    comboBoxTerrainType.setModel(new DefaultComboBoxModel(Terrain.getConfiguredValues()));
    comboBoxTerrainType.setSelectedItem(Terrain.DIRT);
    comboBoxTerrainType.setRenderer(new TerrainListCellRenderer(colourScheme));
    buttonCancel.setText("Cancel");
    buttonCancel.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCancelActionPerformed(evt);
        }
    });
    buttonOK.setText("OK");
    buttonOK.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonOKActionPerformed(evt);
        }
    });
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel1).addGroup(layout.createSequentialGroup().addComponent(jLabel2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(comboBoxTerrainType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonOK).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(buttonCancel).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2).addComponent(spinnerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel3).addComponent(comboBoxTerrainType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(buttonCancel).addComponent(buttonOK)).addContainerGap()));
    pack();
}
Also used : DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) TerrainListCellRenderer(org.pepsoft.worldpainter.themes.TerrainListCellRenderer)

Aggregations

TerrainListCellRenderer (org.pepsoft.worldpainter.themes.TerrainListCellRenderer)6 javax.swing (javax.swing)2 ArrayList (java.util.ArrayList)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 JComboBox (javax.swing.JComboBox)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)1 BiomeListCellRenderer (org.pepsoft.worldpainter.BiomeListCellRenderer)1 ColourScheme (org.pepsoft.worldpainter.ColourScheme)1 CustomBiome (org.pepsoft.worldpainter.biomeschemes.CustomBiome)1 CustomBiomeManager (org.pepsoft.worldpainter.biomeschemes.CustomBiomeManager)1 LayerTableCellRenderer (org.pepsoft.worldpainter.layers.LayerTableCellRenderer)1 JButtonTableCellEditor (org.pepsoft.worldpainter.themes.JButtonTableCellEditor)1 JButtonTableCellRenderer (org.pepsoft.worldpainter.themes.JButtonTableCellRenderer)1 JSpinnerTableCellEditor (org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor)1 TerrainTableCellRenderer (org.pepsoft.worldpainter.themes.TerrainTableCellRenderer)1