use of org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor in project WorldPainter by Captain-Chaos.
the class CustomMaterialDialog method configureTable.
private void configureTable() {
if (jTabbedPane1.getSelectedIndex() == 1) {
TableColumnModel columnModel = tableMaterialRows.getColumnModel();
TableColumn blockIDColumn = columnModel.getColumn(COLUMN_BLOCK_ID);
blockIDColumn.setCellEditor(new BlockIDTableCellEditor(extendedBlockIds));
blockIDColumn.setCellRenderer(new BlockIDTableCellRenderer());
SpinnerModel dataValueSpinnerModel = new SpinnerNumberModel(0, 0, 15, 1);
columnModel.getColumn(COLUMN_DATA_VALUE).setCellEditor(new JSpinnerTableCellEditor(dataValueSpinnerModel));
SpinnerModel occurrenceSpinnerModel = new SpinnerNumberModel(1000, 1, 1000, 1);
columnModel.getColumn(COLUMN_OCCURRENCE).setCellEditor(new JSpinnerTableCellEditor(occurrenceSpinnerModel));
if (tableModel.getMode() == MixedMaterial.Mode.BLOBS) {
SpinnerModel scaleSpinnerModel = new SpinnerNumberModel(100, 1, 9999, 1);
columnModel.getColumn(COLUMN_SCALE).setCellEditor(new JSpinnerTableCellEditor(scaleSpinnerModel));
}
}
}
use of org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor in project WorldPainter by Captain-Chaos.
the class CombinedLayerEditor method configureTable.
private void configureTable() {
tableLayers.setModel(tableModel);
TableColumn layerColumn = tableLayers.getColumnModel().getColumn(COLUMN_LAYER);
JComboBox layerCellEditor = new JComboBox(allLayers.toArray());
layerCellEditor.setRenderer(new LayerListCellRenderer());
layerColumn.setCellEditor(new DefaultCellEditor(layerCellEditor));
layerColumn.setCellRenderer(new LayerTableCellRenderer());
SpinnerModel factorSpinnerModel = new SpinnerNumberModel(100, 1, 1500, 1);
tableLayers.getColumnModel().getColumn(COLUMN_FACTOR).setCellEditor(new JSpinnerTableCellEditor(factorSpinnerModel));
}
use of org.pepsoft.worldpainter.themes.JSpinnerTableCellEditor 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));
}
}
Aggregations