Search in sources :

Example 26 with TableColumnModel

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

the class ContactDetailsTableModel method removeCols.

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

Example 27 with TableColumnModel

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

the class ContactNymTableModel method removeCols.

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

Example 28 with TableColumnModel

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

the class MarketAskTableModel method removeCols.

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

Example 29 with TableColumnModel

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

the class AccountTableModel method setValue.

/*private Object[][] data = {
	    {"Asset1","100"},
	    {"Server2","200"},
	    {"Server3","300"}
	       };*/
public void setValue(Map values, JTable accountTable) {
    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 = accountTable.getColumnModel();
    System.out.println("accountTable.getColumn(2)" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 4) {
        accountTable.removeColumn(tcm.getColumn(3));
    }
    if (tcm.getColumnCount() == 3) {
        accountTable.removeColumn(tcm.getColumn(2));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 30 with TableColumnModel

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

the class AssetContractTableModel method setValue.

public void setValue(Map values, JTable assetTable) {
    clearValue();
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        Integer key = (Integer) iterator.next();
        String[] rowData = new String[2];
        rowData = (String[]) values.get(key);
        /*rowData[0] = (String)values.get(key);
           rowData[1] = String.valueOf(key);*/
        data[i] = rowData;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           assetTable.setRowSorter(sorter);*/
    TableColumnModel tcm = assetTable.getColumnModel();
    System.out.println("getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 2) {
        assetTable.removeColumn(tcm.getColumn(1));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) 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