Java JTable Model getTableContent(TableModel table)

Here you can find the source of getTableContent(TableModel table)

Description

get Table Content

License

Apache License

Declaration

public static LinkedHashMap<String, String> getTableContent(TableModel table) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.apache.http.util.TextUtils;

import javax.swing.table.TableModel;

import java.util.LinkedHashMap;

public class Main {

    public static LinkedHashMap<String, String> getTableContent(TableModel table) {
        int rowCount = table.getRowCount();
        LinkedHashMap<String, String> result = new LinkedHashMap<>();
        for (int row = 0; row < rowCount; row++) {
            String key = (String) table.getValueAt(row, 0);
            if (TextUtils.isEmpty(key))
                continue;
            String value = (String) table.getValueAt(row, 1);
            result.put(key, value);// w w w . j  av  a 2  s .c  o  m
        }
        return result;
    }
}

Related

  1. convertTableToList(DefaultTableModel table)
  2. dumpToText(TableModel m, String filename)
  3. fireTableDataChangedAndKeepSelection(final AbstractTableModel tableModel, final JTable table)
  4. getDefaultTableModel()
  5. getSelectedModelIndex(JTable table)
  6. insertTableModelListener( TableModel model, TableModelListener l, int index)
  7. insertTableModelListener(TableModel model, TableModelListener l, int index)
  8. makeDefaultTableModel(String[] titleA, final Class[] typesA, final boolean[] canEditA)
  9. modelIndexToDisplayIndex(JTable table, int modelIndex)