Search in sources :

Example 91 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class BitcoinReceivedTableModel method setValue.

public void setValue(Map values, JTable receivedTable) {
    clearValue();
    System.out.println("values.size():" + values.size());
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        data[i] = row;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           accountTable.setRowSorter(sorter);*/
    TableColumnModel tcm = receivedTable.getColumnModel();
    System.out.println("receivedTable.getColumn()" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 6) {
        receivedTable.removeColumn(tcm.getColumn(5));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 92 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class OTOutboxTableModel method setValue.

public void setValue(Map values, JTable outbox) {
    if (null == values) {
        System.out.println("OTOutboxTableModel.setValue: Failure: Map 'values' is null.");
        return;
    }
    clearValue();
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        String[] tableData = new String[columnNames.length];
        for (int j = 0; j < tableData.length; j++) tableData[j] = row[j];
        data[i] = tableData;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           outbox.setRowSorter(sorter);*/
    TableColumnModel tcm = outbox.getColumnModel();
    System.out.println("outbox.getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 10)
        outbox.removeColumn(tcm.getColumn(9));
    if (tcm.getColumnCount() == 9) {
        outbox.removeColumn(tcm.getColumn(8));
    }
    if (tcm.getColumnCount() == 8) {
        outbox.removeColumn(tcm.getColumn(7));
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 93 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class OtherTabAccountModel method removeCols.

public static void removeCols(JTable serverTable) {
    TableColumnModel tcm = serverTable.getColumnModel();
    System.out.println("getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 4) {
        serverTable.removeColumn(tcm.getColumn(3));
    }
    if (tcm.getColumnCount() == 3) {
        serverTable.removeColumn(tcm.getColumn(2));
    }
}
Also used : TableColumnModel(javax.swing.table.TableColumnModel)

Example 94 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class OtherTabServerTableModel method removeCols.

public static void removeCols(JTable serverTable) {
    TableColumnModel tcm = serverTable.getColumnModel();
    System.out.println("getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 3) {
        serverTable.removeColumn(tcm.getColumn(2));
    }
    if (tcm.getColumnCount() == 2) {
        serverTable.removeColumn(tcm.getColumn(1));
    }
}
Also used : TableColumnModel(javax.swing.table.TableColumnModel)

Example 95 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class PaymentRecordboxTableModel method removeCols.

public static void removeCols(JTable paymentTable) {
    TableColumnModel tcm = paymentTable.getColumnModel();
    System.out.println("getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 13) {
        paymentTable.removeColumn(tcm.getColumn(12));
    }
    if (tcm.getColumnCount() == 12) {
        paymentTable.removeColumn(tcm.getColumn(11));
    }
    if (tcm.getColumnCount() == 11) {
        paymentTable.removeColumn(tcm.getColumn(10));
    }
    if (tcm.getColumnCount() == 10) {
        paymentTable.removeColumn(tcm.getColumn(9));
    }
}
Also used : TableColumnModel(javax.swing.table.TableColumnModel)

Aggregations

TableColumnModel (javax.swing.table.TableColumnModel)168 TableColumn (javax.swing.table.TableColumn)66 JTable (javax.swing.JTable)34 JScrollPane (javax.swing.JScrollPane)31 JButton (javax.swing.JButton)30 BoxLayout (javax.swing.BoxLayout)24 TableCellEditor (javax.swing.table.TableCellEditor)23 ButtonEditor (jmri.util.table.ButtonEditor)23 ButtonRenderer (jmri.util.table.ButtonRenderer)23 JLabel (javax.swing.JLabel)22 JPanel (javax.swing.JPanel)22 ActionEvent (java.awt.event.ActionEvent)20 ActionListener (java.awt.event.ActionListener)16 FlowLayout (java.awt.FlowLayout)15 Border (javax.swing.border.Border)13 Iterator (java.util.Iterator)12 Set (java.util.Set)12 JTableHeader (javax.swing.table.JTableHeader)12 TableCellRenderer (javax.swing.table.TableCellRenderer)12 Container (java.awt.Container)10