Java Code Examples for javax.swing.table.TableStringConverter

The following examples show how to use javax.swing.table.TableStringConverter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: JuiceboxLegacy   Source File: EncodeTableModel.java    License: MIT License 6 votes vote down vote up
public EncodeTableModel(String[] headings, List<EncodeFileRecord> records) {

        this.records = records;

        List<String> tmp = new ArrayList<String>();
        tmp.add("");  // Checkbox heading
        for (String h : headings) {
            String heading = h.trim();
            if (heading.length() > 0 && !"path".equals(heading)) {
                tmp.add(heading);
            }
        }
        //tmp.add("path");
        columnHeadings = tmp.toArray(new String[tmp.size()]);


        sorter = new TableRowSorter<EncodeTableModel>(this);

        sorter.setStringConverter(new TableStringConverter() {
            @Override
            public String toString(TableModel model, int row, int column) {
                final Object value = model.getValueAt(row, column);
                return value == null ? "" : value.toString();
            }
        });
    }
 
Example 2
Source Project: Juicebox   Source File: EncodeTableModel.java    License: MIT License 6 votes vote down vote up
public EncodeTableModel(String[] headings, List<EncodeFileRecord> records) {

        this.records = records;

        List<String> tmp = new ArrayList<>();
        tmp.add("");  // Checkbox heading
        for (String h : headings) {
            String heading = h.trim();
            if (heading.length() > 0 && !"path".equals(heading)) {
                tmp.add(heading);
            }
        }
        //tmp.add("path");
        columnHeadings = tmp.toArray(new String[tmp.size()]);


        sorter = new TableRowSorter<>(this);

        sorter.setStringConverter(new TableStringConverter() {
            @Override
            public String toString(TableModel model, int row, int column) {
                final Object value = model.getValueAt(row, column);
                return value == null ? "" : value.toString();
            }
        });
    }
 
Example 3
Source Project: netbeans   Source File: ProfilerTable.java    License: Apache License 2.0 5 votes vote down vote up
protected TableRowSorter createRowSorter() {
    ProfilerRowSorter s = new ProfilerRowSorter(getModel());
    s.setStringConverter(new TableStringConverter() {
        public String toString(TableModel model, int row, int column) {
            return getModelStringValue(row, column);
        }
    });
    s.setDefaultSortOrder(SortOrder.DESCENDING);
    s.setSortColumn(0);
    return s;
}
 
Example 4
Source Project: visualvm   Source File: ProfilerTable.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected TableRowSorter createRowSorter() {
    ProfilerRowSorter s = new ProfilerRowSorter(getModel());
    s.setStringConverter(new TableStringConverter() {
        public String toString(TableModel model, int row, int column) {
            return getModelStringValue(row, column);
        }
    });
    s.setDefaultSortOrder(SortOrder.DESCENDING);
    s.setSortColumn(0);
    return s;
}