/** * Constructs a <code>VariabilityRecordTable</code> with a list of variability records. * * @param record_list the list of variability records. * @param desktop the parent desktop. */ public VariabilityRecordTable(Vector record_list, net.aerith.misao.gui.Desktop desktop) { this.record_list = record_list; this.desktop = desktop; index = new ArrayIndex(record_list.size()); model = new DefaultTableModel(column_names, 0); Object[] objects = new Object[column_names.length]; objects[0] = new Boolean(true); for (int i = 1; i < column_names.length; i++) objects[i] = ""; for (int i = 0; i < record_list.size(); i++) model.addRow(objects); setModel(model); column_model = (DefaultTableColumnModel) getColumnModel(); for (int i = 1; i < column_names.length; i++) column_model .getColumn(i) .setCellRenderer( new StringRenderer(column_names[i], LabelTableCellRenderer.MODE_MULTIPLE_SELECTION)); initializeCheckColumn(); setTableHeader(new TableHeader(column_model)); setAutoResizeMode(JTable.AUTO_RESIZE_OFF); initializeColumnWidth(); pane = this; initPopupMenu(); }
/** Initializes the column width. */ protected void initializeColumnWidth() { column_model.getColumn(0).setPreferredWidth(20); column_model.getColumn(1).setPreferredWidth(100); column_model.getColumn(2).setPreferredWidth(100); column_model.getColumn(3).setPreferredWidth(100); column_model.getColumn(4).setPreferredWidth(60); column_model.getColumn(5).setPreferredWidth(60); column_model.getColumn(6).setPreferredWidth(60); column_model.getColumn(7).setPreferredWidth(40); column_model.getColumn(8).setPreferredWidth(40); column_model.getColumn(9).setPreferredWidth(40); column_model.getColumn(10).setPreferredWidth(160); column_model.getColumn(11).setPreferredWidth(160); }