use of jAudioFeatureExtractor.GeneralTools.FeatureDisplay in project jAudioGIT by dmcennis.
the class FeatureSelectorPanel method setUpFeatureTable.
/**
* Initialize the table displaying the features which can be extracted.
*/
private void setUpFeatureTable() {
controller.fstm_.fillTable(controller.dm_.featureDefinitions, controller.dm_.defaults, controller.dm_.is_primary);
decorator = new SortingTableModelDecorator(controller.fstm_);
features_table = new JTable(decorator);
multipleToggleAction = new MultipleToggleAction(features_table);
String key = "MultipleToggleAction";
features_table.getInputMap().put(KeyStroke.getKeyStroke(' '), key);
features_table.getActionMap().put(key, multipleToggleAction);
int[] width = new int[3];
width[0] = decorator.getRealPrefferedWidth(features_table, 0);
width[1] = decorator.getRealPrefferedWidth(features_table, 1);
width[1] -= 100;
width[2] = decorator.getRealPrefferedWidth(features_table, 2);
for (int i = 0; i < width.length; ++i) {
features_table.getColumnModel().getColumn(i).setPreferredWidth(width[i]);
}
// add handler for sorting panel
JTableHeader header = (JTableHeader) features_table.getTableHeader();
header.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
TableColumnModel tcm = features_table.getColumnModel();
int column = features_table.convertColumnIndexToModel(tcm.getColumnIndexAtX(e.getX()));
decorator.sort(column);
} else {
decorator.resetIndeci();
}
}
});
// Set up and display the table
features_scroll_pane = new JScrollPane(features_table);
features_panel = new JPanel(new GridLayout(1, 1));
features_panel.add(features_scroll_pane);
add(features_panel, BorderLayout.CENTER);
controller.fstm_.fireTableDataChanged();
TableColumn tableColumn = features_table.getColumn(features_table.getColumnName(1));
tableColumn.setCellRenderer(new FeatureDisplay());
features_table.removeColumn(features_table.getColumn(features_table.getColumnName(3)));
repaint();
outer_frame.repaint();
}
Aggregations