All Packages Class Hierarchy This Package Previous Next Index
The javax.swing.table.TableModel lacks a method to set column name. MTableModel adds the method to the interface. Use MTableModel instead of TableModel, and add multilizer.SwingModule to your application if you want to translate the column headers of the JTable.
An example:
class MyTableModel extends AbstractTableModel implements MTableModel { final String[] columnNames = { "First Name", //ivlm "Last Name", //ivlm "Sport", //ivlm "Est. Years Experience" //ivlm }; final String[][] data = { {"Mary", "Campione", "Snowboarding", "5"}, {"Alison", "Huml", "Rowing", "3"}, {"Kathy", "Walrath", "Chasing toddlers", "2"}, {"Mark", "Andrews", "Speed reading", "20"}, {"Angela", "Lih", "Teaching high school", "4"} }; public int getColumnCount() { return columnNames.length; } public int getRowCount() { return data.length; } public String getColumnName(int col) { return columnNames[col]; } public void setColumnName(String string, int col) { columnNames[col] = string; fireTableStructureChanged(); } public Object getValueAt(int row, int col) { return data[row][col]; } };
Multilizer does not translate the data cells of the JTable automatically. If you want to translate the data cell write your own code and use the Dictionary.translate method.
public abstract void setColumnName(String string, int columnIndex)
All Packages Class Hierarchy This Package Previous Next Index