I have the following JTable that uses a table model:
http://s17.postimage.org/7zfh3l4lr/Screen_Shot_2012_03_10_at_15_11_31.png
Instead of using A, B, C, D, etc., how can I define my own table names. This is my code.
Here is the code of my table model, the frame creates an object from this table model and displays it in a JFrame.
package uk.ac.kcl.inf._4css1pra.spreadsheet; import java.awt.Dimension; import java.util.HashMap; import java.util.Map; import javax.swing.table.AbstractTableModel; public class Spreadsheet extends AbstractTableModel{ private Map data = new HashMap(); public int getColumnCount() { return 7; } public int getRowCount() { return 250; } public Object getValueAt(int row, int col) { return data.get(new Dimension(row, col)); } public void setValueAt(Object data, int row, int col) { Dimension coord = new Dimension(row, col); this.data.put(coord, data); fireTableCellUpdated(row, col); } }
source share